I don't really know much about .NET 4.0 (using 3.5 for now) but I think there are no way to achieve effect Pure.Krome want.
But approximation to this kind of comparing can be achieved by using arrays and extension methods LINQ provides.
Here is the little example.
string foo = @"very weird";
if (new[] { @"don't do it", @"very weird" }.Contains(foo))
{
Console.WriteLine(@"bingo string");
}
int baa = 7;
if (new []{5, 7}.Contains(baa))
{
Console.WriteLine(@"bingo int");
}
This outputs:
bingo string
bingo int
This way is more resource devouring than simple chain of comparsions and logical operators but provides syntax similar to one Pure.Krome wants to get.
If you are don't want to define arrays with new[] (it's really kinda ungly in logical conditions) you can define yourself extension method for this.
public static class Extensions
{
public static bool IsOneOf<T>(this T obj, params T[] args)
{
return args.Contains(obj);
}
}
So you can use this extension method:
if (baa.IsOneOf(5, 7, 9, 10))
{
Console.WriteLine(@"bingo int");
}
Output is really predictable, heh.