Render names of C# bitfields using enums and FlagsAttribute. Also, adjusting size of enum using, like ushort, for marshalling p


/ Published in: C#
Save to your folder(s)

FlagsAttribute is useful to render a string indicating which status bits or flag bits are turned on. The resulting string will contain the name of the enum bit that is turned on without needed to maintain a separate string table.

Note the inheritance-like syntax that determines the size of the enum. This is useful to adjust the size of enum structure members for marshaling with C.

URL: http://msdn.microsoft.com/en-us/library/system.flagsattribute%28VS.71%29.aspx

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.