C#枚举类型用户标志位的代码
2021-06-24 17:06
标签:ons code 标志位 用处 main 用户 iso ali member C#枚举类型用户标志位的代码 标签:ons code 标志位 用处 main 用户 iso ali member 原文地址:http://blog.51cto.com/14141172/2333198enum Mammalia
{
Bison = 1,
Human = 2,
Mammal = 255
}
public class MammalCheck
{
public static void Main( )
{
Mammalia pattern = Mammalia.Bison | Mammalia.Human;
Mammalia animal = Mammalia.Bison;
if ( (pattern & animal) != 0)
{
Console.WriteLine ("{0} is a member of ({1}).",
animal, pattern);
}
}
}