Type.GetType()

巴扎黑
Release: 2016-12-20 11:23:13
Original
2753 people have browsed it

// .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[j].GetTypes(); 
        for (int k = 0; k < types.Length; k++) 
        { 
            if (types[k].Name.Equals(className) || (types[k].FullName.Equals(className))) 
            { 
                type = types[k]; 
                break; 
            } 
        } 
        if (type != null) 
        { 
            break; 
        } 
    } 

    return type; 

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!