In C# is there a shorthand way to write this:
public static bool IsAllowed(int userID)
{
return (userID == Personnel.JohnDoe || userID == Personnel.JaneD
Are permissions user-id based? If so, you may end up with a better solution by going to role based permissions. Or you may end up having to edit that method quite frequently to add additional users to the "allowed users" list.
For example, enum UserRole { User, Administrator, LordEmperor }
class User {
public UserRole Role{get; set;}
public string Name {get; set;}
public int UserId {get; set;}
}
public static bool IsAllowed(User user) {
return user.Role == UserRole.LordEmperor;
}