mirror of
https://github.com/snltty/linker.git
synced 2025-10-17 06:30:46 +08:00
源生成器替代反射
This commit is contained in:
@@ -1,32 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
|
||||
namespace linker.libs
|
||||
{
|
||||
public sealed class ReflectionHelper
|
||||
{
|
||||
public static IEnumerable<Type> GetInterfaceSchieves(Type type)
|
||||
{
|
||||
return GetInterfaceSchieves(AppDomain.CurrentDomain.GetAssemblies(), type);
|
||||
}
|
||||
/*
|
||||
public static IEnumerable<Type> GetInterfaceSchieves(Assembly[] assemblys, Type type)
|
||||
{
|
||||
return assemblys.SelectMany(c => c.GetTypes())
|
||||
.Where(c => !c.IsAbstract).Where(c => c.GetInterfaces().Contains(type));
|
||||
}
|
||||
public static IEnumerable<Type> GetSubClass(Assembly[] assemblys, Type type)
|
||||
{
|
||||
return assemblys.SelectMany(c => c.GetTypes())
|
||||
.Where(c => !c.IsAbstract).Where(c => c.IsSubclassOf(type));
|
||||
}
|
||||
|
||||
|
||||
public static IEnumerable<Type> GetEnums(Assembly[] assemblys)
|
||||
{
|
||||
return assemblys.SelectMany(c => c.GetTypes())
|
||||
.Where(c => c.IsEnum);
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user