FindIndex in a List

I need to get an index of an object in List with a certain condition.

class Marker
{
  public var index : int;
}

var List.<Marker> allMarkers;

public function GetIndexForMarker (_marker : Marker) : int
{
  return allMarkers.FindIndex(RoadMarker m => m.markerIndex == _marker.markerIndex); //This doesn't work.
}

What basically I need to implement is the following, but with FindIndex to make it shorter.

public function GetIndexForMarker (_marker : Marker) : int
{
  var i : int = 0;
  for (var currentMarker : Marker in allMarkers)
  {
    if (currentMarker.index == _marker.index)
      return i;

    i++;    
  }
}

How can I use FindIndex in JavaScript?

The index you refer to is a variable of your Marker class. So the best way to search a specific number is that you're using in your second example. I don't even think the first one is javascript....

Anyways, if your the index value of your Marker is the same as the index into the List you can just use the IndexOf() method...

int index = allMarkers.IndexOf(marker);


edit

Since i don't have much experience with LINQ and lambda expressions i can't say much about that, but i guess i've found what you're after. According to this question you should look here:

http://unity3d.com/support/documentation/Manual/MonoUpgradeDetails.html