Soenneker.Extensions.Type
11.0.725
Prefix Reserved
dotnet add package Soenneker.Extensions.Type --version 11.0.725
NuGet\Install-Package Soenneker.Extensions.Type -Version 11.0.725
<PackageReference Include="Soenneker.Extensions.Type" Version="11.0.725" />
<PackageVersion Include="Soenneker.Extensions.Type" Version="11.0.725" />
<PackageReference Include="Soenneker.Extensions.Type" />
paket add Soenneker.Extensions.Type --version 11.0.725
#r "nuget: Soenneker.Extensions.Type, 11.0.725"
#:package Soenneker.Extensions.Type@11.0.725
#addin nuget:?package=Soenneker.Extensions.Type&version=11.0.725
#tool nuget:?package=Soenneker.Extensions.Type&version=11.0.725
Soenneker.Extensions.Type
Reflection and text-conversion helpers for runtime Type values.
Installation
dotnet add package Soenneker.Extensions.Type
Convert text to a target type
using Soenneker.Extensions.Type;
object? port = typeof(int).ConvertPropertyValue("8080");
object? ids = typeof(Guid[]).ConvertPropertyValue("6f9619ff-8b86-d011-b42d-00cf4fc964ff, 7c9e6679-7425-40de-944b-e07fc1f90ae7");
ConvertPropertyValue() supports strings, numeric primitives, booleans, DateTime, DateTimeOffset, TimeSpan, Guid, Uri, char, DateOnly, TimeOnly, enums, nullable values, arrays, and List<T>. Parsing is invariant-culture and trims the input. Arrays and lists use comma-separated tokens.
Invalid scalar input returns null. A collection also returns null when a non-empty element cannot be converted, rather than silently substituting a default value. An empty token is valid as null only for Nullable<T> elements. Enum parsing is case-insensitive and, like Enum.TryParse, accepts numeric values even when the enum does not define them.
URI conversion accepts relative or absolute URIs. Date/time conversion parses text but does not apply an application-specific time-zone policy.
Read JSON property names
string jsonName = typeof(Order).GetJsonPropertyName(nameof(Order.OrderId));
GetJsonPropertyName() returns JsonPropertyNameAttribute.Name when the exact public CLR property has that attribute; otherwise it returns the input name. It does not apply a JsonSerializerOptions.PropertyNamingPolicy. Successful property lookups are cached with a bounded cache.
Inspect types
GetFieldsOfType<T>()reads public static fields, including inherited public static fields, whose declared field type is assignable toT.GetInterfacesAndSelf()returns implemented interfaces for a class. For an interface, it returns that interface first, followed by its inherited interfaces in reflection order.IsNumeric()recognizes the built-in CLR integer and floating-point types, includingdecimal. It does not unwrap nullable types or classify enums and user-defined numeric types as numeric.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net11.0 is compatible. |
-
net11.0
- Soenneker.Enumerables.CommaSeparated (>= 11.0.34)
NuGet packages (5)
Showing the top 5 NuGet packages that depend on Soenneker.Extensions.Type:
| Package | Downloads |
|---|---|
|
Soenneker.Extensions.Object
A collection of helpful Object extension methods |
|
|
Soenneker.Json.CollectionConverter
A System.Text.Json converter for (de)serializing collections |
|
|
Soenneker.SmartEnum.Abbreviated
A derivative of Ardalis' SmartEnum, adding support for abbreviations |
|
|
Soenneker.Excel.Util
Provides methods for reading and writing Excel files using strongly-typed objects with automatic property mapping and basic type conversion |
|
|
Soenneker.Csv.SepCsvUtil
Using the Sep CSV library, provides methods for reading and writing CSV files using strongly-typed objects with automatic property mapping and basic type conversion |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 11.0.725 | 2,585 | 11/11/2026 |
| 11.0.724 | 436 | 11/11/2026 |
| 11.0.723 | 326 | 11/10/2026 |
| 11.0.722 | 15,805 | 10/26/2026 |
| 4.0.720 | 8,322 | 10/14/2026 |
| 4.0.719 | 952 | 10/14/2026 |
| 4.0.717 | 845 | 10/14/2026 |
| 4.0.711 | 1,007 | 10/13/2026 |
| 4.0.710 | 161 | 10/12/2026 |
| 4.0.707 | 4,858 | 10/11/2026 |
| 4.0.706 | 416 | 10/11/2026 |
| 4.0.705 | 14,410 | 9/26/2026 |
| 4.0.704 | 2,418 | 9/24/2026 |
| 4.0.703 | 8,067 | 9/15/2026 |
| 4.0.702 | 432 | 9/15/2026 |
| 4.0.701 | 8,527 | 9/12/2026 |
| 4.0.700 | 133 | 9/12/2026 |
| 4.0.699 | 11,598 | 9/7/2026 |
| 4.0.698 | 15,272 | 8/30/2026 |
| 4.0.697 | 2,880 | 8/30/2026 |
Update dependency Soenneker.Enumerables.CommaSeparated to 11.0.34 (#814)