Advertisement
andrew4582

IsPrimitiveType

Jul 6th, 2013
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.64 KB | None | 0 0
  1.         internal static bool IsPrimitiveType(Type type)
  2.         {
  3.             if ((type == typeof(string)) ||
  4.                 (type == typeof(bool)) ||
  5.                 (type == typeof(byte)) ||
  6.                 (type == typeof(char)) ||
  7.                 (type == typeof(DateTime)) ||
  8.                 (type == typeof(decimal)) ||
  9.                 (type == typeof(double)) ||
  10.                 (type == typeof(Guid)) ||
  11.                 (type == typeof(short)) ||
  12.                 (type == typeof(int)) ||
  13.                 (type == typeof(long)) ||
  14.                 (type == typeof(sbyte)) ||
  15.                 (type == typeof(float)) ||
  16.                 (type == typeof(TimeSpan)) ||
  17.                 (type == typeof(ushort)) ||
  18.                 (type == typeof(uint)) ||
  19.                 (type == typeof(ulong)))
  20.                 return true;
  21.             else
  22.                 return false;
  23.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement