Exemple #1
0
        /// <summary>
        /// Returns an <see cref="ObjectXRay"/> instance for the specified <paramref name="type"/> and <paramref name="instance"/>.
        /// </summary>
        public static ObjectXRay NewType(System.Type type, object instance)
        {
            ObjectXRay newInstance = NewType(type);

            newInstance._instance = instance;
            return(newInstance);
        }
Exemple #2
0
        /// <summary>
        /// Returns an <see cref="ObjectXRay"/> instance for the specified <paramref name="typename"/> (in <paramref name="assembly"/>)
        /// and <paramref name="instance"/>.
        /// </summary>
        public static ObjectXRay NewType(string assembly, string typename, object instance)
        {
            ObjectXRay newInstance = NewType(assembly, typename);

            newInstance._instance = instance;
            return(newInstance);
        }
Exemple #3
0
        /// <summary>
        /// Returns an <see cref="ObjectXRay"/> instance for the specified <paramref name="type"/>.
        /// </summary>
        public static ObjectXRay NewType(System.Type type)
        {
            ObjectXRay newInstance = new ObjectXRay();

            newInstance._t = type;
            return(newInstance);
        }
Exemple #4
0
        /// <summary>
        /// Returns an <see cref="ObjectXRay"/> instance for the specified <paramref name="typename"/> (in <paramref name="assembly"/>).
        /// </summary>
        public static ObjectXRay NewType(string assembly, string typename)
        {
            Assembly a = Assembly.Load(assembly);

            if (a == null)
            {
                throw new ArgumentException("Assembly '" + assembly + "' could not be loaded.");
            }
            ObjectXRay newInstance = new ObjectXRay();
            Type       type        = a.GetType(assembly + "." + typename);

            if (type == null)
            {
                throw new ArgumentException("Type '" + typename + "' could not be loaded from assembly '" + assembly + "'.");
            }
            newInstance._t = type;
            return(newInstance);
        }