- using System;
- public enum Pets
- {
- None = 0, Dog = 1, Cat = 2, Bird = 4,
- Rodent = 8, Other = 16
- };
- public class Example
- {
- public static void Main()
- {
- Pets value = Pets.Bird | Pets.Cat;
- Console.WriteLine(Pets.IsDefined(typeof(Pets), 4));
- string name = value.ToString();
- Console.WriteLine(Pets.IsDefined(typeof(Pets),2));
- }
- }
OUTPUT
True
True
