Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

c# get classes which inherits

public static class ReflectiveEnumerator
{
    static ReflectiveEnumerator() { }

    public static IEnumerable<T> GetEnumerableOfType<T>(params object[] constructorArgs) where T : class, IComparable<T>
    {
        List<T> objects = new List<T>();
        foreach (Type type in 
            Assembly.GetAssembly(typeof(T)).GetTypes()
            .Where(myType => myType.IsClass && !myType.IsAbstract && myType.IsSubclassOf(typeof(T))))
        {
            objects.Add((T)Activator.CreateInstance(type, constructorArgs));
        }
        objects.Sort();
        return objects;
    }
}
Comment

PREVIOUS NEXT
Code Example
Csharp :: c# itext 7 PdfDocument from byte array 
Csharp :: Sort ListBox numerically in C# 
Csharp :: To CharArray 
Csharp :: All Possible SubString of string 
Csharp :: unity game object remove parent 
Csharp :: C# fileinfo creation date 
Csharp :: c# random number between 0 and 1 
Csharp :: unity vector3 to array 
Csharp :: stringify c# 
Csharp :: c# scroll to bottom of datagridview vb.net 
Csharp :: unity gameobject find inactive 
Csharp :: linked list reverse 
Csharp :: how read excel data in c# 
Csharp :: c# override gethashcode 
Csharp :: element click intercepted exception in selenium C# 
Csharp :: ActionExecutingContext result response return 
Csharp :: reverse linked list 
Csharp :: c# get date without time 
Csharp :: c# sum object values 
Csharp :: listbox1.remove item c# 
Csharp :: how to fix on Input.GetMouseButtonDown(0) conting as ui 
Csharp :: for jump script unity 2d 
Csharp :: dxf read c# 
Csharp :: c# ? 
Csharp :: c# xmldocument from file 
Csharp :: generate UUID id for my entities 
Csharp :: run dll file 
Csharp :: program.cs entity framework 
Csharp :: convert getdate to ist c# 
Csharp :: c# invokerequired wpf 
ADD CONTENT
Topic
Content
Source link
Name
7+3 =