?????????????
??????????????10?????2????0~20??????
????10????????0??1??2??3??4??5??6??7??8??9??10??11??12??13??14??15??16??17??18??19??20
????2????????00000??00001??00010??00011??00100??00101??00110??00111??01000??01001??01010??01011??01100??01101??01110??01111??10000??10001??10010??10011??10100
??????2??????0~20?У????????????2??????η??????λ???????仯?????λ?????????1??????λ???0??????????????£?
????00000??00001??00010????00100??01000??10000
???????10????????0??1??2??4??8??16
???????????Щ?????????λ????????????????11111????5λ????1
??????????????????????????????????????λ????????????????????????????????λ??????????????????????????????????0??????????????1???????????????????????????????????????????????
????????????????????????????????磺
????typeof(Program).GetProperties(BindingFlags.Instance | BindingFlags.Public | BindingFlags.Static);
????BindingFlags???????£?

????????????????????2??η???????????????2????????????????????????????????????
?????塢?????????
Console.WriteLine("??????");
ButtonStyle userbtnStyle = ButtonStyle.OK | ButtonStyle.Cancel | ButtonStyle.Alert | ButtonStyle.Info;//???????????ButtonStyle????????????????????ó?2???????1111
string buttonStyleStr = null;
//????λ????ж??????????userbtnStyle??????????
if ((userbtnStyle & ButtonStyle.AlertInfo) == ButtonStyle.AlertInfo)
{
buttonStyleStr += "+" + Enum.GetName(typeof(ButtonStyle)?? ButtonStyle.AlertInfo);
}
else if ((userbtnStyle & ButtonStyle.Alert) == ButtonStyle.Alert)
{
buttonStyleStr += "+" + Enum.GetName(typeof(ButtonStyle)?? ButtonStyle.Alert);
}
else if ((userbtnStyle & ButtonStyle.Info) == ButtonStyle.Info)
{
buttonStyleStr += "+" + Enum.GetName(typeof(ButtonStyle)?? ButtonStyle.Info);
}
if ((userbtnStyle & ButtonStyle.OKCancel) == ButtonStyle.OKCancel)
{
buttonStyleStr += "+" + Enum.GetName(typeof(ButtonStyle)?? ButtonStyle.OKCancel);
}
else if ((userbtnStyle & ButtonStyle.OK) == ButtonStyle.OK)
{
buttonStyleStr += "+" + Enum.GetName(typeof(ButtonStyle)?? ButtonStyle.OK);
}
else if ((userbtnStyle & ButtonStyle.Cancel) == ButtonStyle.Cancel)
{
buttonStyleStr += "+" + Enum.GetName(typeof(ButtonStyle)?? ButtonStyle.Cancel);
}
Console.WriteLine("???????????У?" + buttonStyleStr.Substring(1));
enum ButtonStyle
{
None = 0x00??
OK = 0x01??
Cancel = 0x02??
Alert = 0x04??
Info = 0x08??
OKCancel = 0x01 | 0x02??
AlertInfo = 0x04 | 0x08
}
????????????
???????????????У?AlertInfo+OKCancel
??????????userbtnStyle?????????????????
????????????????
Console.WriteLine("????壺");
AllowType userPermission = AllowType.Add | AllowType.Update | AllowType.Upload | AllowType.Download | AllowType.Select;
string userPermissionStr = null;
if ((userPermission & AllowType.Edit) == AllowType.Edit)
{
userPermissionStr += "+" + Enum.GetName(typeof(AllowType)?? AllowType.Edit);
}
else
{
if ((userPermission & AllowType.Add) == AllowType.Add)
{
userPermissionStr += "+" + Enum.GetName(typeof(AllowType)?? AllowType.Add);
}
if ((userPermission & AllowType.Update) == AllowType.Update)
{
userPermissionStr += "+" + Enum.GetName(typeof(AllowType)?? AllowType.Update);
}
if ((userPermission & AllowType.Delete) == AllowType.Delete)
{
userPermissionStr += "+" + Enum.GetName(typeof(AllowType)?? AllowType.Delete);
}
if ((userPermission & AllowType.Upload) == AllowType.Upload)
{
userPermissionStr += "+" + Enum.GetName(typeof(AllowType)?? AllowType.Upload);
}
}
if ((userPermission & AllowType.Read) == AllowType.Read)
{
userPermissionStr += "+" + Enum.GetName(typeof(AllowType)?? AllowType.Read);
}
else
{
if ((userPermission & AllowType.Select) == AllowType.Select)
{
userPermissionStr += "+" + Enum.GetName(typeof(AllowType)?? AllowType.Select);
}
if ((userPermission & AllowType.Download) == AllowType.Download)
{
userPermissionStr += "+" + Enum.GetName(typeof(AllowType)?? AllowType.Download);
}
}
Console.WriteLine("????????????У?" + userPermissionStr.Substring(1));
enum AllowType
{
None = 0??
Add = 1??
Update = 2??
Delete = 4??
Select = 8??
Upload = 16??
Download = 32??
Edit = Add | Update | Delete | Upload??
Read = Select | Download
}
????????????
????????????????У?Add+Update+Upload+Read
??????????userPermission?????????????????
??????????????????????????λ??λ???????????????λ???????????????λ????????????????а????????
???????????????λ????
Console.WriteLine("???????");
int x1 = 108;
Console.Write("~λ??????:{0} -->> {1} ; {2} -->> {3} "??
Convert.ToString(x1?? 10)?? Convert.ToString(~x1?? 10)??
Convert.ToString(x1?? 2)?? Convert.ToString(~x1?? 2));
Console.Write("<<λ????(??5λ)????:{0} -->> {1} ; {2} -->> {3} "??//????????????Nλ??????????????油Nλ0
Convert.ToString(x1?? 10)?? Convert.ToString(x1 << 5?? 10)??
Convert.ToString(x1?? 2)?? Convert.ToString(x1 << 5?? 2));
Console.Write(">>λ????(??5λ)????:{0} -->> {1} ; {2} -->> {3} "??//????????????Nλ??????????????????Nλ????????0??1??
Convert.ToString(x1?? 10)?? Convert.ToString(x1 >> 5?? 10)??
Convert.ToString(x1?? 2)?? Convert.ToString(x1 >> 5?? 2));
Console.Write("^λ???(???5)????:{0} ^ {1} -->> {2} ; {3} ^ {4}-->> {5} "??
Convert.ToString(x1?? 10)??Convert.ToString(5?? 10)?? Convert.ToString(x1 ^ 5?? 10)??
Convert.ToString(x1?? 2)?? Convert.ToString(5?? 2)?? Convert.ToString(x1 ^ 5?? 2));
????????????
????~λ??????:108 -->> -109 ; 1101100 -->> 11111111111111111111111110010011
????<<λ????(??5λ)????:108 -->> 3456 ; 1101100 -->> 110110000000
????>>λ????(??5λ)????:108 -->> 3 ; 1101100 -->> 11
????^λ???(???5)????:108 ^ 5 -->> 105 ; 1101100 ^ 101-->> 1101001
????~??????????????????????????????????????λ????????? 0 ?? 1??1?? 0??
????<<???????????????????????λ??????????λ??????????????Nλ??????????????油Nλ0
????>>???????????????????????λ??????????λ??????????λ?????????????????????λ?? 0??????????????Nλ??????????????????Nλ????????0??1??
????^??????? ??? XOR ??????????????????μ??????????????λ?????????0????????1???? 0^0=0; 0^1=1; 1^0=1;1^1=0;?????????????????0?????0??????????????0????????????1
????С?????????
??????????????????????0??1??????????????????????2?ó???????????????10???????????0??1??2??4??8??16??32??64??128??256??16???????????0x00??0x01??0x02??0x04??0x08??0x10??0x20??0x40??0x80
???????10???????????16?????????????????????16?????????????????????????????????????????????(????????0??1??2??4??8????????λ??????????)?????磺
????0x00??0x01??0x02??0x04??0x08??0x10??0x20??0x40??0x80??0x100??0x200??0x400??0x800??0x1000
?????????10????????0??1??2??4??8??16??32??64??128??256??512??1024??2048??4096
????????16?????????????Щ?????????????*2??????????????????