DefaultNamespace.corcls.FindClass C# (CSharp) Method

FindClass() protected static method

FindClass() will locate the classname using various search rules.
protected static FindClass ( String className, Assembly module ) : Type
className String
module System.Reflection.Assembly
return System.Type
    protected static Type FindClass( String className, Assembly module ) 
    {
      Type cls = null;

      if (module == null) 
      {
        // find the class using regular methods
        cls = Type.GetType( className );

        // this failed, so try again with "System." in front
        if (cls == null) 
        {
          for (int i = 0; i < packagesToAttempt.Length; i++) 
          {
            cls = Type.GetType( packagesToAttempt[ i ] + "." + className );
            if (cls != null) 
            {
              break;
            }
          }
        }
      }
      else 
      {
        // find the class using the given module
        cls = module.GetType( className );

        // this failed, so try again with "System." in front
        if (cls == null) 
        {
          for (int i = 0; i < packagesToAttempt.Length; i++) 
          {
            cls = module.GetType( packagesToAttempt[ i ] + "." + className );
            if (cls != null) 
            {
              break;
            }
          }
        }
      }

      return cls;
    }