Find Type By Name - CSharp System.Reflection

CSharp examples for System.Reflection:Type

Description

Find Type By Name

Demo Code


using System.Reflection;
using System.Linq;
using System.Collections.Generic;
using System;/*from  w  w w  .  j a  v a2 s. co m*/

public class Main{
        public static Type FindTypeByName(this Assembly assembly, string name)
        {
            return assembly.GetTypes().SingleOrDefault(c => c.Name.Equals(name, StringComparison.InvariantCultureIgnoreCase));
        }
}

Related Tutorials