huhu_long 发表于 2013-2-5 09:06:10

Type.GetType()

// .net code

private Type GetType(string className)
{
    // Creates current domain.
    AppDomain currentDomain = AppDomain.CurrentDomain;

    // Makes an array for the list of assemblies.
    Assembly[] assems = currentDomain.GetAssemblies();

    Type type = null;
    for (int j = 0; j < assems.Length; j++)
    {
      Type[] types = assems.GetTypes();
      for (int k = 0; k < types.Length; k++)
      {
            if (types.Name.Equals(className) || (types.FullName.Equals(className)))
            {
                type = types;
                break;
            }
      }
      if (type != null)
      {
            break;
      }
    }

    return type;
}
页: [1]
查看完整版本: Type.GetType()