When I add this code
DateTimeStyles.AdjustToUniversal | DateTimeStyles.AllowInnerWhite
Intellisense shows the following message:
DateTimeStyles DateTimeStyles.operator |(DateTimeStyles left, DateTimeStyles right).
What does this operator do?
DateTimeStyles
isn't an operator - it's an enum, and all enums have the |
operator. All it does is apply a bitwise |
for the two values. It should only be used for flag-based enums. For example:
public enum AccessMode
{
None = 0,
Read = 1,
Write = 2,
Delete = 4
}
If you use:
AccessMode mode = AccessMode.Write | AccessMode.Delete;
then you'll have a value with an underlying integer value of 6.
Basically, it allows you to specify a single value representing multiple flags within the enum - so for you're example, you're saying "I want the result to be adjusted to UTC, and allow inner whitespace when parsing."
See more on this question at Stackoverflow