P Patrick Blackman Aug 8, 2004 #1 Need example of how to use the flags attribute and to determine which flags were set.
A Adrian Aug 8, 2004 #2 I don't know about a flags attribute, but using flags shouldn't be a problem. bool flag = false; if (......) flag = true; if(flag == true) // DO SOMETHING
I don't know about a flags attribute, but using flags shouldn't be a problem. bool flag = false; if (......) flag = true; if(flag == true) // DO SOMETHING
S Sijin Joseph Aug 8, 2004 #3 [Flags] enum ActionAttributes { Read = 1, Write = 2, Delete = 4, Query = 8, Sync = 16 } This is how you define an enumerated type with the FlagsAttribute To assign e.g. ActionAttributes aa = ActionAttributes.Read | ActionAttributes.Write; To check if aa has the Read Attribute e.g. if ( (aa && ActionAttributes.Read) == ActionAttributes.Read) {}
[Flags] enum ActionAttributes { Read = 1, Write = 2, Delete = 4, Query = 8, Sync = 16 } This is how you define an enumerated type with the FlagsAttribute To assign e.g. ActionAttributes aa = ActionAttributes.Read | ActionAttributes.Write; To check if aa has the Read Attribute e.g. if ( (aa && ActionAttributes.Read) == ActionAttributes.Read) {}