GetType() public static method

public static GetType ( Assembly assembly, String typeName ) : Type
assembly System.Reflection.Assembly
typeName String
return System.Type
示例#1
0
        /// <summary>
        /// Obtains the <c>Type</c> by checking if the
        /// <c>typeName</c> is possible a full type name, or
        /// just an namespace.typename and for the later case,
        /// it tries to load the type from the specified assembly
        /// </summary>
        /// <param name="assembly"></param>
        /// <param name="typeName"></param>
        /// <returns></returns>
        private Type ObtainType(Assembly assembly, String typeName)
        {
            if (typeName == null)
            {
                return(null);
            }

            if (typeName.IndexOf(',') == -1)
            {
                return(InferType(assembly, typeName));
            }
            else
            {
                return(TypeLoadUtil.GetType(typeName));
            }
        }
示例#2
0
        private IFacility InstatiateFacility(String facilityType)
        {
            Type type = TypeLoadUtil.GetType(facilityType);

            return((IFacility)Activator.CreateInstance(type));
        }
示例#3
0
 /// <summary>
 /// This method always tries to obtain the type
 /// from the specified assembly.
 /// </summary>
 /// <param name="typeName"></param>
 /// <param name="assembly"></param>
 /// <returns></returns>
 private Type InferType(Assembly assembly, String typeName)
 {
     return(TypeLoadUtil.GetType(assembly, typeName));
 }