for ( ....... ) in C#

Hello guys, I have a really simple question. I have this code in js :

for (var plane in planes){ 
DoSomething();
}

so how can I write this code in C# ? I just tried

for ( plane in planes ) or some sort of things but I couldn’t find the usage . I think it’s very simple for c# coders, thanks :slight_smile:

    foreach ( var plane in planes ) {
        DoSomething();
    }

You may want to use a more specific type, rather than relying on var, but that’s fundamentally what you’re looking for.

foreach(var plane in planes)
{
Debug.Log(plane.gameObject.name);
}