In C# is there a shorthand way to write this:
public static bool IsAllowed(int userID)
{
return (userID == Personnel.JohnDoe || userID == Personnel.JaneD
How about something like this:
public static bool IsAllowed(int userID) {
List IDs = new List { 1,2,3,4,5 };
return IDs.Contains(userID);
}
(You could of course change the static status, initialize the IDs class in some other place, use an IEnumerable<>, etc, based on your needs. The main point is that the closest equivalent to the in operator in SQL is the Collection.Contains() function.)