This is actually an answer to an old post which is closed. But it may nevertheless be useful to someone.
Old Post: Has if () syntax of C# no IN operator like Pascal or SQL (IN, LIKE,BETWEEN)?
Good, short and fast possibility is to define the enum as flags, like e.g.:
You can then test for a flag like this:
Note that TokenType.Empty must be defined as 0.
Old Post: Has if () syntax of C# no IN operator like Pascal or SQL (IN, LIKE,BETWEEN)?
Good, short and fast possibility is to define the enum as flags, like e.g.:
Code:
[Flags]
internal enum TokenType
{
Empty = 0,
LBrace = 1,
PlusLBrace = 2,
RBrace = 4,
LBracket = 8,
RBracket = 16,
Period = 32,
RecordID = 64,
Rubbish = 128,
TermStartSymbols = RecordID | LBrace | PlusLBrace | LBracket
}
Code:
while ((CurrentToken.Type & TokenType.TermStartSymbols) != TokenType.Empty) {
sequence.Add(Term());
}