CSharp examples for System:Type
Get Variable Type
using System.Reflection; using System.Linq; using System.Collections.Generic; using System;/*from ww w .j av a2 s. c o m*/ public class Main{ public static Type GetVariableType(this MemberInfo member) { if (member is FieldInfo) { return ((FieldInfo)member).FieldType; } if (member is PropertyInfo) { return ((PropertyInfo)member).PropertyType; } throw new Exception("Can only get VariableType of Fields and Properties"); } }