¡@

Home 

c# Programming Glossary: value.gettype

Show Enum Description Instead of Name

http://stackoverflow.com/questions/11439920/show-enum-description-instead-of-name

in values select new Value value Description value.GetType .GetMember value.ToString 0 .GetCustomAttributes true..

How to have userfriendly names for enumerations? [duplicate]

http://stackoverflow.com/questions/1331487/how-to-have-userfriendly-names-for-enumerations

string GetDescription this Enum value FieldInfo field value.GetType .GetField value.ToString object attribs field.GetCustomAttributes.. string GetDescription this Enum value FieldInfo field value.GetType .GetField value.ToString object attribs field.GetCustomAttributes..

General type conversion without risking Exceptions

http://stackoverflow.com/questions/2111280/general-type-conversion-without-risking-exceptions

type1Cache _Types s.GetType if type1Cache.ContainsKey value.GetType We havent converted this type before so create a new conversion.. a new conversion type2Cache new ConversionCache s.GetType value.GetType Add to the cache type1Cache.Add value.GetType type2Cache .. s.GetType value.GetType Add to the cache type1Cache.Add value.GetType type2Cache else type2Cache type1Cache value.GetType Attempt..

How to get C# Enum description from value? [duplicate]

http://stackoverflow.com/questions/2650080/how-to-get-c-sharp-enum-description-from-value

static string GetEnumDescription Enum value FieldInfo fi value.GetType .GetField value.ToString DescriptionAttribute attributes DescriptionAttribute..

In Protobuf-net how can I pass an array of type object with objects of different types inside, knowing the set of potential types in advance

http://stackoverflow.com/questions/2678249/in-protobuf-net-how-can-i-pass-an-array-of-type-object-with-objects-of-different

static MessageParam CreateDynamic object value Type type value.GetType switch Type.GetTypeCode value.GetType special cases case TypeCode.Int32.. value Type type value.GetType switch Type.GetTypeCode value.GetType special cases case TypeCode.Int32 return Create int value case..

Extending Enums, Overkill?

http://stackoverflow.com/questions/3015893/extending-enums-overkill

GetStringValue this Enum value Get the type Type type value.GetType Get fieldinfo for this type FieldInfo fieldInfo type.GetField.. GetDisplayText this Enum value Get the type Type type value.GetType Get fieldinfo for this type FieldInfo fieldInfo type.GetField..

Iterate over values in Flags Enum?

http://stackoverflow.com/questions/4171140/iterate-over-values-in-flags-enum

this Enum value return GetFlags value Enum.GetValues value.GetType .Cast Enum .ToArray public static IEnumerable Enum GetIndividualFlags.. this Enum value return GetFlags value GetFlagValues value.GetType .ToArray private static IEnumerable Enum GetFlags Enum value..

C# String enums

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

GetStringValue Enum value string output null Type type value.GetType Check first in our cached results... Look for our 'StringValueAttribute'..

Get Enum from Description attribute [duplicate]

http://stackoverflow.com/questions/4367723/get-enum-from-description-attribute

string GetDescription this Enum value FieldInfo field value.GetType .GetField value.ToString DescriptionAttribute attribute Attribute.GetCustomAttribute..

Model Binding to Enums in ASP.NET MVC 3

http://stackoverflow.com/questions/6051756/model-binding-to-enums-in-asp-net-mvc-3

providerValue.RawValue if null value var valueType value.GetType if valueType.IsEnum return Enum.ToObject propertyType value..