Question: What is the equivalent in C# for Delphi's in syntax, like:

```

  if (iIntVar in [2,96]) then 
  begin
    //some code
  end;

```

Thanks

Answer: 
In .Net, .Contains is the closest, but the syntax is the opposite of what you wrote.

You could write an extension method to be able to create a .In method

```
public static bool In<T>(this T obj, IEnumerable<T> arr)
 {
  return arr.Contains(obj);
 }

```

And usage would be

```
if (42.In(new[] { 12, 42, 46, 74 }) )
{
    //TODO: Something
}

```
You could write an extension method

```
 public static bool In(this int value, int[] range)
    {
        return (value >= range[0] && value <= range[1]);
    }

```