Ejemplo n.º 1
0
        private static GetValue getGetMethodFromInitialReflection <T>(T obj)
            where T : class
        {
            var type = typeof(T);

            if (getMethods.ContainsKey(type))
            {
                var found = (GetValue)getMethods[typeof(T)];
                return(found);
            }
            else
            {
                var built = GetHelper.Value(type);
                if (built != null)
                {
                    getMethods.Add(typeof(T), built);
                    return(built);
                }
            }
            return(null);
        }
Ejemplo n.º 2
0
        public static GetValue GetMethod2(object obj)
        {
            var type       = obj.GetType();
            var fullName   = type.FullName;
            var assembly   = type.Assembly;
            var types      = assembly.GetTypes();
            var objectType = type.Assembly.GetTypes().FirstOrDefault(t => t.FullName == type.FullName);

            if (getMethods.ContainsKey(objectType))
            {
                var found = (GetValue)getMethods[objectType];
                return(found);
            }
            else
            {
                var built = GetHelper.Value(objectType);
                if (built != null)
                {
                    getMethods.Add(objectType, built);
                    return(built);
                }
            }
            return(null);
        }