<p>In C# is there a shorthand way to write this:</p>

<pre><code>public static bool IsAllowed(int userID)
{
    return (userID == Personnel.JohnDoe || userID == Personnel.JaneDoe ...);
}
</code></pre>

<p>Like:</p>

<pre><code>public static bool IsAllowed(int userID)
{
    return (userID in Personnel.JohnDoe, Personnel.JaneDoe ...);
}
</code></pre>

<p>I know I could also use switch, but there are probably 50 or so functions like this I have to write (porting a classic ASP site over to ASP.NET) so I'd like to keep them as short as possible.</p>

I would encapsulate the list of allowed IDs as
data
not
code
. Then it's source can be changed easily later on.
```
```
List<int> allowedIDs = ...;

public bool IsAllowed(int userID)
{
    return allowedIDs.Contains(userID);
}
```
```
If using .NET 3.5, you can use
```
IEnumerable
```
instead of
```
List
```
thanks to extension methods.
(This function shouldn't be static. See this posting:
using too much static bad or good ?
.)