packages/System.Linq.Dynamic.Core.1.0.7.9/src/System.Linq.Dynamic.Core/Compatibility/CustomIntrospectionExtensions.cs
(完整代码) 1KBusing System.Linq;
namespace System.Reflection
{
/// <summary>
/// https://github.com/castleproject/Core/blob/netcore/src/Castle.Core/Compatibility/IntrospectionExtensions.cs
/// </summary>
internal static class CustomIntrospectionExtensions
{
#if NET35 || NET40 || PORTABLE || SILVERLIGHT || WPSL
// This allows us to use the new reflection API which separates Type and TypeInfo
// while still supporting .NET 3.5 and 4.0. This class matches the API of the same
// class in .NET 4.5+, and so is only needed on .NET Framework versions before that.
//
// Return the System.Type for now, we will probably need to create a TypeInfo class
// which inherits from Type like .NET 4.5+ and implement the additional methods and
// properties.
public static Type GetTypeInfo(this Type type)
{
return type;
}
public static Type[] GetGenericTypeArguments(this Type type)
{
return type.GetGenericArguments();
}
public static MethodInfo[] GetDeclaredMethods(this Type type, string name)
{
return type.GetMethods().Where(m => m.Name == name).ToArray();
}
#else
public static Type[] GetGenericTypeArguments(this TypeInfo typeInfo)
{
return typeInfo.GenericTypeArguments;
}
#endif
}
}
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
