|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
<Flags()> ENUM attibuteI've used bitwise enums before (powers of 2) and have used AND and OR operator to determine which individual flags have been set, but I have never used the <Flags()> _ attribute
What advantage does this give me? Thankoo "Chad" <chad.dokmanov***@unisys.com> schrieb: I am not sure if it's currently the case but this attribute could by used by >I've used bitwise enums before (powers of 2) and have used AND > and OR operator to determine which individual flags have been set, > but I have never used the <Flags()> _ attribute > >What advantage does this give me? the properties window, for example, to provide the ability to combine flags. -- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://classicvb.org/petition/> >What advantage does this give me? Like Herfried said it's mostly a benefit for tools, but it alsochanges the behavior of methods such as Enum.Format. Try this <Flags> _ Enum WithFlags One = 1 Two = 2 End Enum Enum NoFlags One = 1 Two = 2 End Enum Class Test Shared Sub Main() Console.WriteLine(System.Enum.Format(GetType(WithFlags), 3, "g")) Console.WriteLine(System.Enum.Format(GetType(NoFlags), 3, "g")) End Sub End Class Mattias -- Mattias Sjögren [C# MVP] mattias @ mvps.org http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com Please reply only to the newsgroup.
Image Upload problem - tearing hair out here!!
Books: (I'm converting vb release 4 to release 8) But will eventually move it to other PCs simple OO question Generating Reports Using VB.net Writing and reading from a template Excel file using ADO.Net - results not recalculated Red Semaphore. Ideas? minimizing viewstate Managed DX - 'DrawText' ambiguous Translating VB6 Code to kill the screen saver. Using a User's Control of VB.NET in a Form of VB6 |
|||||||||||||||||||||||