¡@

Home 

c# Programming Glossary: attrs

Bit fields in C#

http://stackoverflow.com/questions/14464/bit-fields-in-c-sharp

f in t.GetType .GetFields object attrs f.GetCustomAttributes typeof BitfieldLengthAttribute false if.. typeof BitfieldLengthAttribute false if attrs.Length 1 uint fieldLength BitfieldLengthAttribute attrs 0.. attrs.Length 1 uint fieldLength BitfieldLengthAttribute attrs 0 .Length Calculate a bitmask of the desired length long mask..

How do attribute classes work?

http://stackoverflow.com/questions/2676603/how-do-attribute-classes-work

TestClass Console.WriteLine after class constructor var attrs Attribute.GetCustomAttributes test.GetType .Dump foreach var.. test.GetType .Dump foreach var attr in attrs if attr is TestClassAttribute Console.WriteLine attr.ToString..

C# String enums

http://stackoverflow.com/questions/424366/c-sharp-string-enums

FieldInfo fi type.GetField value.ToString StringValue attrs fi.GetCustomAttributes typeof StringValue false as StringValue.. typeof StringValue false as StringValue if attrs.Length 0 output attrs 0 .Value return output Good now I've.. false as StringValue if attrs.Length 0 output attrs 0 .Value return output Good now I've got the tools to get..

Enum ToString

http://stackoverflow.com/questions/479410/enum-tostring

if memberInfo null memberInfo.Length 0 object attrs memberInfo 0 .GetCustomAttributes typeof DescriptionAttribute.. .GetCustomAttributes typeof DescriptionAttribute false if attrs null attrs.Length 0 Pull out the description value return.. typeof DescriptionAttribute false if attrs null attrs.Length 0 Pull out the description value return DescriptionAttribute..

Reflection - get attribute name and value on property

http://stackoverflow.com/questions/6637679/reflection-get-attribute-name-and-value-on-property

.GetProperties foreach PropertyInfo prop in props object attrs prop.GetCustomAttributes true foreach object attr in attrs .. attrs prop.GetCustomAttributes true foreach object attr in attrs AuthorAttribute authAttr attr as AuthorAttribute if authAttr..

ServiceStack.Net Redis: Storing Related Objects vs. Related Object Ids

http://stackoverflow.com/questions/8914349/servicestack-net-redis-storing-related-objects-vs-related-object-ids

back . Defaults are overrideable with DataMember attrs but not recommended since it uglifies your POCOs. Entities are..