This repository was archived by the owner on Dec 24, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -313,6 +313,17 @@ public static MethodInfo Method(this Delegate fn)
313
313
#endif
314
314
}
315
315
316
+
317
+ #if ( NETFX_CORE || PCL || NETSTANDARD1_1 )
318
+ [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
319
+ public static MethodInfo GetGetMethod ( this PropertyInfo pi ) =>
320
+ pi . GetMethod ;
321
+
322
+ [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
323
+ public static MethodInfo GetSetMethod ( this PropertyInfo pi , bool nonPublic = true ) =>
324
+ pi . SetMethod ( nonPublic ) ;
325
+ #endif
326
+
316
327
[ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
317
328
public static bool HasAttribute < T > ( this Type type )
318
329
{
Original file line number Diff line number Diff line change @@ -624,6 +624,19 @@ public static object CreateInstance(string typeName)
624
624
return ctorFn ( ) ;
625
625
}
626
626
627
+ [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
628
+ public static Module GetModule ( this Type type )
629
+ {
630
+ if ( type == null )
631
+ return null ;
632
+
633
+ #if NETSTANDARD1_1
634
+ return type . GetTypeInfo ( ) . Module ;
635
+ #else
636
+ return type . Module ;
637
+ #endif
638
+ }
639
+
627
640
public static PropertyInfo [ ] GetAllProperties ( this Type type )
628
641
{
629
642
if ( type . IsInterface ( ) )
You can’t perform that action at this time.
0 commit comments