ActDim.Reflectron
1.0.1
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
The owner has unlisted this package.
This could mean that the package is deprecated, has security vulnerabilities or shouldn't be used anymore.
dotnet add package ActDim.Reflectron --version 1.0.1
NuGet\Install-Package ActDim.Reflectron -Version 1.0.1
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="ActDim.Reflectron" Version="1.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ActDim.Reflectron" Version="1.0.1" />
<PackageReference Include="ActDim.Reflectron" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add ActDim.Reflectron --version 1.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: ActDim.Reflectron, 1.0.1"
#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.
#:package ActDim.Reflectron@1.0.1
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=ActDim.Reflectron&version=1.0.1
#tool nuget:?package=ActDim.Reflectron&version=1.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
ActDim.Reflectron
ActDim.Reflectron is a high-performance .NET reflection engine providing compiled expression-tree property getters, setters, dynamic method callers, and strongly-typed member accessors that eliminate traditional System.Reflection runtime invocation overhead.
Features
- Compiled Expression Tree Accessors: Compile property getters and setters into
Func<object, object>andAction<object, object>delegates cached per property. - Fast Dynamic Method Invocation: Call methods dynamically using compiled delegates (
FastMethodCallDelegate,FastDynamicDelegate) rather than expensiveMethodInfo.Invoke. - Expression-Based Member Access: Safely retrieve
MemberInfo,PropertyInfo, orMethodInfousing strongly-typed lambda expressions (TypeAccess.GetMemberInfo(() => obj.Property)) instead of dangerous magic strings. - Generic Type Factory Helpers: Helper utilities for dynamically creating
FuncandActiongeneric delegates (TypeAccess.GetFuncType,TypeAccess.GetActionType). - Zero Configuration Caching: Built-in concurrent thread-safe delegate caches for optimal repeated performance.
Installation
Install via the .NET CLI:
dotnet add package ActDim.Reflectron
Or via Package Manager Console:
Install-Package ActDim.Reflectron
Quick Start Examples
1. Strongly-Typed Member Retrieval
using ActDim.Reflectron;
using System.Reflection;
public class User
{
public string Name { get; set; }
}
// Retrieve PropertyInfo safely without string literals
MemberInfo member = TypeAccess.GetMemberInfo((User u) => u.Name);
Console.WriteLine(member.Name); // Output: Name
2. Fast Property Setters and Getters
using ActDim.Reflectron;
using System.Reflection;
var user = new User { Name = "Initial" };
PropertyInfo propInfo = typeof(User).GetProperty(nameof(User.Name));
// Obtain or create cached compiled setter
var setter = TypeAccess.GetPropertySetter(propInfo);
// Execute compiled setter (near-native speed)
setter(user, "Updated Name");
Console.WriteLine(user.Name); // Output: Updated Name
3. Fast Dynamic Delegate Calls
using ActDim.Reflectron;
using System.Reflection;
MethodInfo method = typeof(string).GetMethod(nameof(string.ToUpper), System.Type.EmptyTypes);
var fastCaller = FastMethodCallDelegate.Create(method);
object result = fastCaller("hello world", null);
Console.WriteLine(result); // Output: HELLO WORLD
License
This project is licensed under the MIT License.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net10.0
- ActDim.Practix.Common (>= 1.0.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.