Smart way to find the corresponding nullable type?

Posted by Marc Wittke on Stack Overflow See other posts from Stack Overflow or by Marc Wittke
Published on 2009-12-16T10:55:23Z Indexed on 2010/04/07 2:53 UTC
Read the original article Hit count: 538

Filed under:
|
|
|

How could I avoid this dictionary (or create it dynamically)?

Dictionary<Type,Type> CorrespondingNullableType = new Dictionary<Type, Type>

{ {typeof(bool), typeof(bool?)}, {typeof(byte), typeof(byte?)}, {typeof(sbyte), typeof(sbyte?)}, {typeof(char), typeof(char?)}, {typeof(decimal), typeof(decimal?)}, {typeof(double), typeof(double?)}, {typeof(float), typeof(float?)}, {typeof(int), typeof(int?)}, {typeof(uint), typeof(uint?)}, {typeof(long), typeof(long?)}, {typeof(ulong), typeof(ulong?)}, {typeof(short), typeof(short?)}, {typeof(ushort), typeof(ushort?)}, {typeof(Guid), typeof(Guid?)}, };

© Stack Overflow or respective owner

Related posts about c#

Related posts about reflection