Shiny.Reflector
v1.6.0-beta-0004Pre-release
net9.0
A high speed reflection library... without the actual reflection
Published
Jul 1, 2025
1y ago
Total Downloads
11.5K
11,518
Install
dotnet add package Shiny.Reflector --version 1.6.0-beta-0004
| Product | Versions |
|---|---|
| .NET |
README
Shiny Reflector
Reflection without the actual... reflection. AOT compliant!
Usage
Using the following attribute and marking your class as partial
[Shiny.Reflector.ReflectorAttribute]
public partial class MyClass
{
public int MyProperty { get; set; }
public string Message { get; set;}
}
Works on records as well, but you must use the
partialkeyword and attribute just like a class.
Just that attribute allows you to do this:
var myClass = new MySampleClass
{
Name = "Hello World",
Age = null
};
// NOTE: the use of GetReflector - a reflector class is generated for each class marked with the ReflectorAttribute
var reflector = myClass.GetReflector();
foreach (var prop in reflector.Properties)
{
var objValue = reflector[prop.Name];
Console.WriteLine($"Property: {prop.Name} ({prop.Type}) - Current Value: {objValue}");
}
// generics for type casting
var name = reflector.GetValue<string>("Name");
Console.WriteLine("Reflector Name: " + name);
// indexers for loose typing
Console.WriteLine("Reflector Value: " + reflector["age"]);
// set with generics
reflector.SetValue("Age", 99);
// or just an object on the indexer
reflector["name"] = "Something Else";
Console.WriteLine("Reflector Name Value: " + reflector["NaMe"]);
Console.WriteLine("Reflector Age Value: " + reflector["NaMe"]);
Changes from Previous Version
No structural changes between v1.6.0-beta-0003 and v1.6.0-beta-0004.
Adoption Assessment
A verified publisher signal is available. Assess fit from the package's supported frameworks, license and dependency graph rather than popularity alone.
This version is marked prerelease. Validate its API and upgrade path before production use.Compatibility metadata lists 1 target framework; confirm the exact target used by your application.
Related Guides & Workflows
Learn how to evaluate, integrate, or audit this package in your .NET project.