Type Summary

						public class FlagsAttribute : Attribute
{
  // Constructors
     public FlagsAttribute ();
}

BA Enums in the runtime are just like enums in the C++ programming language. That is, they are really just aliases for integral types. There is no enforcement in the runtime, languages, or verifier that ensures that a value stored in an enum has a valid name associated with it. For example, this is legal code:

FileMode f = (FileMode) 42;

The implication of this is that a robust library should always check to see if the value being passed in is legal. The Flags attribute indicates that the enum was designed such that not all the legal values have a name; some legal values are combinations of values with names. For example, in the AttributeTargets ...

Get .NET Framework Standard Library Annotated Reference, Volume 1: Base Class Library and Extended Numerics Library now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.