Example #1
0
        public static TypedMemberBase GetTypedMember(string memberName, Type memberType)
        {
            TypedMemberBase typedMember     = null;
            Type            typedMemberType = typeof(TypedMember <>).MakeGenericType(memberType);


            typedMember = Activator.CreateInstance(typedMemberType, memberName) as TypedMemberBase;

            return(typedMember);
        }
Example #2
0
        public static TypedMemberBase GetTypedMemberUnequatable(string memberName, Type memberType)
        {
            TypedMemberBase typedMember = null;

            Type typedMemberType = null;

            if (memberType == null)
            {
                typedMemberType = typeof(TypedMemberUnequatable <>).MakeGenericType(typeof(object));
            }
            else
            {
                typedMemberType = typeof(TypedMemberUnequatable <>).MakeGenericType(memberType);
            }


            typedMember = Activator.CreateInstance(typedMemberType, memberName) as TypedMemberBase;

            return(typedMember);
        }
Example #3
0
        public static TypedMemberBase GetTypedMember(string memberName, Type memberType)
        {
            TypedMemberBase typedMember = null;

            Type typedMemberType = null;

            try
            {
                typedMemberType = typeof(TypedMember <>).MakeGenericType(memberType);
            }
            catch (ArgumentException)
            {
                // Maybe it's not an equatable, so try unequatable:
                typedMemberType = typeof(TypedMemberUnequatable <>).MakeGenericType(memberType);
            }

            typedMember = Activator.CreateInstance(typedMemberType, memberName) as TypedMemberBase;

            return(typedMember);
        }