Rop.Reflection
1.0.3
.NET 6.0
This package targets .NET 6.0. The package is compatible with this framework or higher.
.NET Standard 2.0
This package targets .NET Standard 2.0. The package is compatible with this framework or higher.
dotnet add package Rop.Reflection --version 1.0.3
NuGet\Install-Package Rop.Reflection -Version 1.0.3
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Rop.Reflection" Version="1.0.3" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Rop.Reflection --version 1.0.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Rop.Reflection, 1.0.3"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Rop.Reflection as a Cake Addin #addin nuget:?package=Rop.Reflection&version=1.0.3 // Install Rop.Reflection as a Cake Tool #tool nuget:?package=Rop.Reflection&version=1.0.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Rop.Reflection
Features
Helper classes to cheat code with reflection
Cheat
static classes
/// Enumerates all interfaces that matches a filter
public static IEnumerable<Type> FilterInterfaces<K>(this Type t, Func<Type, K, bool> filter, K arg);
/// Check if class implement a interface
public static bool ImplementsInterface(this Type t, Type @interface);
/// Check if class implement a generic interface
public static bool ImplementsGenericInterface(this Type t, Type @interface);
/// Check if member is decorated with any of attributes
public static bool IsDecorated(this MemberInfo m, params string[] attributes);
/// List all implementation of generic interface
public static IEnumerable<Type> GetImplementationsOfGenericInterfaces(this Type t, Type genericinterfacebase);
/// List all arguments of generic interface implementation
public static Type[] GetArgumentsOfGenericInterface(this Type t, Type genericinterfacebase);
/// List argument type of generic interface implementation
public static Type GetTypeOfGenericInterface(this Type t, Type genericinterfacebase);
/// Get backing field of a fieldname with field not declared
public static FieldInfo GetBackingField(this Type t, PropertyInfo prop);
/// Get private field
public static FieldInfo GetPrivateField(this Type t, string fieldname);
/// Get private method
public static MethodInfo GetPrivateMethod(this Type t, string method);
/// Get private static method
public static MethodInfo GetPrivateStaticMethod(this Type t, string method);
/// Get public static method
public static MethodInfo GetStaticMethod(this Type t, string method);
/// Get private property
public static PropertyInfo GetPrivateProperty(this Type t, string property);
/// Get private field of type
public static FieldInfo GetPrivateField(Type t, string field, Type declaringtype);
/// Get private method of type
public static MethodInfo GetPrivateMethod(Type t, string property, Type declaringtype);
/// Create object with init parameters
public static T NewWithParams<T>(params object[] initparams);
/// Create a derived object with init parameters
public static T NewDerivedWithParams<T>(Type derivedtype, params object[] initparams);
public static IEnumerable<Type> GetNestedClassesOfType(this Type t, Type @base, BindingFlags? flags = null);
public static IEnumerable<Type> GetNestedClassesOfType<T>(Type @base, BindingFlags? flags = null);
public static IEnumerable<Type> GetNestedClassesOfType<T, U>(BindingFlags? flags = null);
public static IEnumerable<Type> GetNestedClassesOfType<T>(BindingFlags? flags = null);
/// Get all properties of type T
public static IEnumerable<PropertyInfo> GetPropertiesOfBaseType<T>(this Type @base);
/// Get hidden constructor
public static ConstructorInfo GetHiddenContructor(Type t, params Type[] paramTypes);
public static ConstructorInfo GetHiddenContructor<T>(params Type[] paramTypes);
/// Get value of attribute of a class
public static TValue GetAttributeValue<TAttribute, TValue>(this Type type,Func<TAttribute, TValue> valueSelector);
/// Create derived class
public static T CreateDerivedInstanceOf<T>(Type t);
DecoratedMembers
static classes
/// Check if custom attributedata are in a list of attribute names
public static bool AttributeDataMatch(this CustomAttributeData a, params string[] names);
/// Member filter Anydecorated member
public static readonly MemberFilter DecoratedMemberAny;
/// Member filter one decorate member
public static readonly MemberFilter DecoratedMember1;
/// Get decorated member
public static IEnumerable<MemberInfo> GetDecoratedMemberAny(this Type t,MemberTypes mtype,BindingFlags bindingFlags,params string[] attributes);
public static IEnumerable<MemberInfo> GetDecoratedMember(this Type t,MemberTypes mtype,BindingFlags bindingFlags,string attribute);
/// Get decorated properties
public static IEnumerable<PropertyInfo> GetDecoProperties(this Type t,params string[] attributes);
public static PropertyInfo GetDecoProperty(this Type t,string attribute);
/// Get decorated class
public static CustomAttributeData GetDecoratedAttribute(this Type t,string attribute);
/// Get decorated value
public static T GetDecoratedValue<T>(this Type t,string attribute);
(C)2022 Ramón Ordiales Plaza
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 is compatible. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.0
- System.Runtime (>= 4.3.1)
-
.NETStandard 2.1
- System.Runtime (>= 4.3.1)
-
net6.0
- System.Runtime (>= 4.3.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.