In .net (c# or vb) expressions, how would you implement SQL's handy IN() functionality?
i.e. value in (1, 2, 4, 7)
rather than:
value = 1 or value = 2 or value = 4 or value = 7
using System;
using System.Linq;
static class SqlStyleExtensions
{
public static bool In(this string me, params string[] set)
{
return set.Contains(me);
}
}
Usage:
if (Variable.In("AC", "BC", "EA"))
{
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With