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
                    
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="Soenneker.Utils.Reflection" Version="11.0.476" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Soenneker.Utils.Reflection" Version="11.0.476" />
                    
Directory.Packages.props
<PackageReference Include="Soenneker.Utils.Reflection" />
                    
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 Soenneker.Utils.Reflection --version 11.0.476
                    
#r "nuget: Soenneker.Utils.Reflection, 11.0.476"
                    
#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 Soenneker.Utils.Reflection@11.0.476
                    
#: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=Soenneker.Utils.Reflection&version=11.0.476
                    
Install as a Cake Addin
#tool nuget:?package=Soenneker.Utils.Reflection&version=11.0.476
                    
Install as a Cake Tool

alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image

alternate text is missing from this package README image 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 Compatible and additional computed target framework versions.
.NET net11.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • 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
Loading failed

Configure .NET CI defaults and daily source scans