File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed
src/Extensions/Reflection Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change 11using System . Collections . Generic ;
2+ using System . Linq ;
23using System . Threading ;
34
45namespace System . Reflection
@@ -35,6 +36,8 @@ internal TypeInfo(Type type)
3536
3637 public Type AsType ( ) => _type ;
3738
39+ public bool IsAssignableFrom ( Type type ) => _type . IsAssignableFrom ( type ) ;
40+
3841 public bool IsAssignableFrom ( TypeInfo typeInfo ) => _type . IsAssignableFrom ( typeInfo . AsType ( ) ) ;
3942
4043 public bool IsGenericParameter => _type . IsGenericParameter ;
@@ -195,6 +198,14 @@ public override bool Equals(object obj)
195198 internal static class IntrospectionExtensions
196199 {
197200#if NET40
201+
202+ public static Attribute GetCustomAttribute ( this ParameterInfo info , Type type )
203+ {
204+ return info . GetCustomAttributes ( type , true )
205+ . Cast < Attribute > ( )
206+ . FirstOrDefault ( ) ;
207+ }
208+
198209 public static TypeInfo GetTypeInfo ( this Type type )
199210 {
200211 if ( type == null )
You can’t perform that action at this time.
0 commit comments