ActDim.Reflectron 1.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package ActDim.Reflectron --version 1.0.0
                    
NuGet\Install-Package ActDim.Reflectron -Version 1.0.0
                    
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.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ActDim.Reflectron" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="ActDim.Reflectron" />
                    
Project file
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.0
                    
#r "nuget: ActDim.Reflectron, 1.0.0"
                    
#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.0
                    
#: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.0
                    
Install as a Cake Addin
#tool nuget:?package=ActDim.Reflectron&version=1.0.0
                    
Install as a Cake Tool

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> and Action<object, object> delegates cached per property.
  • Fast Dynamic Method Invocation: Call methods dynamically using compiled delegates (FastMethodCallDelegate, FastDynamicDelegate) rather than expensive MethodInfo.Invoke.
  • Expression-Based Member Access: Safely retrieve MemberInfo, PropertyInfo, or MethodInfo using strongly-typed lambda expressions (TypeAccess.GetMemberInfo(() => obj.Property)) instead of dangerous magic strings.
  • Generic Type Factory Helpers: Helper utilities for dynamically creating Func and Action generic 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 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.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.10 30 8/26/2026
1.0.9 75 8/25/2026
1.0.8 65 8/25/2026
1.0.7 84 8/20/2026
1.0.6 82 8/19/2026
1.0.5 81 8/19/2026
1.0.4 88 8/19/2026
1.0.3 93 8/18/2026
1.0.2 90 8/18/2026
1.0.1 85 8/17/2026
1.0.0 82 8/17/2026