标签:ons code 标志位 用处 main 用户 iso ali member
在写代码之余,把写代码过程比较好的一些代码段收藏起来,下面的代码是关于C#枚举类型用户标志位的代码,应该能对各位朋友有用处。enum 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);
}
}
}
标签:ons code 标志位 用处 main 用户 iso ali member
原文地址:http://blog.51cto.com/14141172/2333198