FastReflections is a lightweight and high-performance utility library for .NET that provides fast, cached reflection-based access to methods, properties, using expressions, and types with clean and expressive syntax.
dotnet add package FastReflections
var instance = new MyClass();
var method = typeof(MyClass).GetMethod("SayHello");
var result = FastReflections.Invoke<MyClass, string>(method, instance, "John");
// result => "Hello, John"
var instance = new MyClass { Name = "FastReflections" };
var value = FastReflections.GetPropertyValue(instance, x => x.Name);
// value => "FastReflections"
var instance = new MyClass();
FastReflections.SetPropertyValue(instance, x => x.Name, "Updated");
// instance.Name => "Updated"
var type = FastReflections.GetTypeByName("MyNamespace.MyClass");
// type => typeof(MyClass)
Use FastReflections
when:
- You need dynamic access to methods and properties
- You want performance without writing boilerplate reflection code
- You’re building frameworks, tools, or extensible plugins
- Uses
Expression Trees
for performance - Thread-safe
ConcurrentDictionary
for caching - Automatic type cache loading via
AssemblyLoad
event
MIT License © LauanGuermandi