You are trying to do something that does not make sense. To see how this works, take a simple example: an array with values: 9, 4, 1.
If you try to run your code in this pattern array, you will receive an error message:
foreach (int i in variable1)
{
if (variable1[i] == 1)
{
}
{
:
foreach (int i in variable1)
{
if (i == 1)
{
}
}
, 0, 1 2, :
for (int i=0 ; i<=variable1.Length ; i++)
{
if (variable1[i] == 1)
{
}
}