Java to C# syntax problem * Solved

Hey! i need to “translate” a for loop from java to C#.
but i can’t manage to convert it to C# syntax.

i’ve looked at this C# example:

foreach (ItemType item in someList)
{
    item.DoSomething();
}

but i can’t translate this one:

for (var state : AnimationState in animation) {
			state.speed = 1.5;
			}

do i have to pre-define variables for that? or something.
thanks.

This doesn’t work? If so, what’s the compile error?

foreach(AnimationState state in animation)
{
	state.speed = 1.5;
}

EDIT: what type is animation? Does it have a collection of “AnimationState” objects?

i missed a couple of things there.
ye it had a animation state collection. but what i was missing was a part of the syntax in the translation.

a little stupid, hehe.

foreach(AnimationState state in animation)
{
   state.speed = 1.5f;
}

worked. thanks!