public static Type ResultType(this MemberInfo memberInfo) { var resultType = memberInfo.MaybeAs <PropertyInfo>().Bind(x => x.PropertyType) .OrElse(() => memberInfo.MaybeAs <MethodInfo>().Bind(x => x.ReturnType)) .OrElse(() => memberInfo.MaybeAs <FieldInfo>().Bind(x => x.FieldType)).Value; return(resultType); }
public static Type ResultType(this MemberInfo memberInfo) { return(memberInfo.MaybeAs <PropertyInfo>(true) .Bind((PropertyInfo x) => x.PropertyType) .OrElse(() => memberInfo.MaybeAs <MethodInfo>(true) .Bind((MethodInfo x) => x.ReturnType)) .OrElse(() => memberInfo.MaybeAs <FieldInfo>(true) .Bind((FieldInfo x) => x.FieldType)).Value); }