Soenneker.Utils.Reflection
11.0.476
Prefix Reserved
dotnet add package Soenneker.Utils.Reflection --version 11.0.476
NuGet\Install-Package Soenneker.Utils.Reflection -Version 11.0.476
<PackageReference Include="Soenneker.Utils.Reflection" Version="11.0.476" />
<PackageVersion Include="Soenneker.Utils.Reflection" Version="11.0.476" />
<PackageReference Include="Soenneker.Utils.Reflection" />
paket add Soenneker.Utils.Reflection --version 11.0.476
#r "nuget: Soenneker.Utils.Reflection, 11.0.476"
#:package Soenneker.Utils.Reflection@11.0.476
#addin nuget:?package=Soenneker.Utils.Reflection&version=11.0.476
#tool nuget:?package=Soenneker.Utils.Reflection&version=11.0.476
Soenneker.Utils.Reflection
Reads public string constants from a type and caches the reflected field metadata for subsequent calls.
Installation
dotnet add package Soenneker.Utils.Reflection
Quick start
using Soenneker.Utils.Reflection;
Call the static ReflectionUtil methods directly; no dependency-injection registration is required.
Usage
public static class Headers
{
public const string RequestId = "X-Request-Id";
public const string CorrelationId = "X-Correlation-Id";
public const int MaximumLength = 128; // ignored: not a string
public static readonly string RuntimeValue = "ignored"; // ignored: not const
}
Dictionary<string, string> headers = ReflectionUtil.GetConstantsFromType<Headers>();
// The runtime-Type overload is equivalent:
Dictionary<string, string> sameHeaders = ReflectionUtil.GetConstantsFromType(typeof(Headers));
The result contains public static literal fields whose value is a non-null string. Non-public
fields, static readonly fields, non-string constants, and null string constants are ignored.
Public inherited constants returned by Type.GetFields(BindingFlags.Public | BindingFlags.Static)
are included as well.
Metadata is reflected once per Type and cached for the process lifetime. Every call materializes
a new case-sensitive Dictionary<string, string>, so adding or removing entries from the returned
dictionary does not affect later callers. The cache has no eviction; avoid feeding an unbounded
stream of dynamically generated types.
Field order is not part of the contract. If a type hierarchy exposes multiple included fields with the same name, dictionary materialization throws because names are used as unique keys.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net11.0 is compatible. |
-
net11.0
- No dependencies.
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 |
|---|---|---|
| 11.0.476 | 43 | 11/18/2026 |
| 11.0.475 | 91 | 11/11/2026 |
| 11.0.474 | 103 | 10/27/2026 |
| 11.0.473 | 94 | 10/26/2026 |
| 11.0.472 | 100 | 10/26/2026 |
| 4.0.471 | 199 | 10/14/2026 |
| 4.0.470 | 107 | 10/14/2026 |
| 4.0.465 | 100 | 10/13/2026 |
| 4.0.463 | 103 | 10/11/2026 |
| 4.0.462 | 150 | 9/26/2026 |
| 4.0.461 | 152 | 9/15/2026 |
| 4.0.460 | 119 | 9/14/2026 |
| 4.0.459 | 128 | 8/31/2026 |
| 4.0.458 | 131 | 8/30/2026 |
| 4.0.457 | 137 | 8/29/2026 |
| 4.0.456 | 131 | 8/26/2026 |
| 4.0.455 | 219 | 7/27/2026 |
| 4.0.454 | 138 | 7/16/2026 |
| 4.0.453 | 1,392 | 6/18/2026 |
| 4.0.451 | 188 | 6/5/2026 |
Configure .NET CI defaults and daily source scans