Anarkin

Untitled

May 8th, 2015
225
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.01 KB | None | 0 0
  1.         private string ExtractPropertyInfoType(PropertyInfo property)
  2.         {
  3.             var isNumber =
  4.                 property.PropertyType == typeof(sbyte) ||
  5.                 property.PropertyType == typeof(byte) ||
  6.                 property.PropertyType == typeof(char) ||
  7.                 property.PropertyType == typeof(short) ||
  8.                 property.PropertyType == typeof(ushort) ||
  9.                 property.PropertyType == typeof(int) ||
  10.                 property.PropertyType == typeof(uint) ||
  11.                 property.PropertyType == typeof(long) ||
  12.                 property.PropertyType == typeof(ulong);
  13.  
  14.             if (isNumber)
  15.             {
  16.                 return "number";
  17.             }
  18.  
  19.             if (property.PropertyType == typeof(string))
  20.             {
  21.                 return "string";
  22.             }
  23.  
  24.             if (property.PropertyType == typeof(DateTime))
  25.             {
  26.                 return "Date";
  27.             }
  28.  
  29.             return property.PropertyType.Name;
  30.         }
Advertisement
Add Comment
Please, Sign In to add comment