About 1,380,000 results
Open links in new tab
  1. Enumeration types - C# reference | Microsoft Learn

    Aug 8, 2025 · To indicate that an enumeration type declares bit fields, apply the Flags attribute to it. As the following example shows, you can also include some typical combinations in the …

  2. What does the [Flags] Enum Attribute mean in C#?

    Aug 12, 2008 · A Flags is an attribute that allows us to represent an enum as a collection of values rather than a single value. So, let’s see how we can implement the Flags attribute on …

  3. C# - enum Flags Attribute Examples - Dot Net Perls

    Aug 2, 2024 · An enum type with the Flags attribute can have multiple constant values assigned to it. With Flags, it is still possible to test enums in switches and if -statements.

  4. Understanding the Flag Enums in C#

    The [Flags] attribute in C# allows an enum to represent a combination of values using bitwise operations. This is useful when an enum needs to store multiple values simultaneously.

  5. C# – How to use enum flags - makolyte

    Sep 2, 2020 · In this article, I’ll show how to create and use enum flags. To enable an enum to have multiple values: Add the [Flags] attribute to the enum type. Set the enum integer values …

  6. Working with flags in C# - Software Particles

    Jan 17, 2022 · Learn how to use Flags in .NET with C#. Store multiple states in one enumeration object and take advantage of bitwise operations.

  7. System.FlagsAttribute class - .NET | Microsoft Learn

    Jan 8, 2024 · The FlagsAttribute attribute indicates that an enumeration can be treated as a bit field; that is, a set of flags. Bit fields are generally used for lists of elements that might occur in …

  8. Defining and Using Enums as Bit Flags in C# - aaronbos.dev

    Dec 22, 2022 · In this post, we are going to dive into how the Flags attribute can be applied to enums and also the different kinds of operations that come into play when an enum is defined …

  9. Flags Attribute For Enum in C# - Code Maze

    Aug 10, 2022 · A Flags is an attribute that allows us to represent an enum as a collection of values rather than a single value. So, let’s see how we can implement the Flags attribute on …

  10. How to check if any flags of a flag combination are set?

    Aug 27, 2009 · Is there a simpler way to check if any of the flags of a combined flag constant are set than the following? This checks that both A and B are set, and ignores whether any other …