Mastronardi.Utils.Reflection
1.1.11
Prefix Reserved
dotnet add package Mastronardi.Utils.Reflection --version 1.1.11
NuGet\Install-Package Mastronardi.Utils.Reflection -Version 1.1.11
<PackageReference Include="Mastronardi.Utils.Reflection" Version="1.1.11" />
paket add Mastronardi.Utils.Reflection --version 1.1.11
#r "nuget: Mastronardi.Utils.Reflection, 1.1.11"
// Install Mastronardi.Utils.Reflection as a Cake Addin #addin nuget:?package=Mastronardi.Utils.Reflection&version=1.1.11 // Install Mastronardi.Utils.Reflection as a Cake Tool #tool nuget:?package=Mastronardi.Utils.Reflection&version=1.1.11
Reflection Utils
Fast Activator
The normal instance activator is not fast, period. So here comes the fast activator:
var myObject = (MyObject)FastActivator.CreateInstance(typeof(MyObject));
This was for objects with a default constructor, for objects with parameters in the constructor you can do this:
var myObject = (MyObject)FastActivator<T1, T2, T3>.CreateInstance(typeof(MyObject));
T1 to T3 are the types of your arguments. For now only three arguments are available.
Fast Delegate
When you want to use reflection to get or set a property it is slow. Why not create a delegate for it?
PropertyInfo.BindGet();
or for setting:
PropertyInfo.BindSet();
it will return a delegate you can reuse in your application.
For Methods you can do it ike this
var method = MethodInfo.Bind();
It will give you the method delegate to keep calling the method in a fast manner.
Static functions
You can use the Functions.GetValue
method to get the value of an object by its string property name, it caches the reflection side for you.
Extension Methods
On an Enum you can do GetAttributeOfType
to get a specific attribute from the Enum in a fast way.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. 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 is compatible. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net45 is compatible. net451 was computed. net452 was computed. net46 is compatible. 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. |
-
.NETCoreApp 3.1
- System.Reflection.Emit (>= 4.7.0)
- System.Reflection.Emit.Lightweight (>= 4.7.0)
-
.NETFramework 4.5
- System.Reflection.Emit (>= 4.7.0)
- System.Reflection.Emit.Lightweight (>= 4.7.0)
-
.NETFramework 4.6
- System.Reflection.Emit (>= 4.7.0)
- System.Reflection.Emit.Lightweight (>= 4.7.0)
-
.NETStandard 2.0
- System.Reflection.Emit (>= 4.7.0)
- System.Reflection.Emit.Lightweight (>= 4.7.0)
NuGet packages (4)
Showing the top 4 NuGet packages that depend on Mastronardi.Utils.Reflection:
Package | Downloads |
---|---|
Mastronardi.Utils.Serialization
The Serialization Utils help with serializeing to and from Base64, Binary, Xml, ... |
|
Mastronardi.Utils.Web
The Web utils help working with HTML, cleaning HTML, Parsing it, Parsing CSS, Embedding images, Querystring handling |
|
Mastronardi.Utils.Validation
The Validation utils help you validate input, like a number or email... |
|
Mastronardi.Utils.Azure.Functions
A library containing extra useful extensions for Azure Functions |
GitHub repositories
This package is not used by any popular GitHub repositories.