CSharp examples for System.Reflection:Type
Get Member Type
using System.Reflection; using System.Linq.Expressions; using System.Collections.Generic; using System;/* w w w . j a v a2s. c om*/ public class Main{ protected static Type GetMemberType(MemberInfo memberInfo) { if (memberInfo is FieldInfo) return ((FieldInfo)memberInfo).FieldType; if (memberInfo is PropertyInfo) return ((PropertyInfo)memberInfo).PropertyType; throw new Exception("illegal state, expecting property or field"); } }