TypeCache 10.0.1
dotnet add package TypeCache --version 10.0.1
NuGet\Install-Package TypeCache -Version 10.0.1
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="TypeCache" Version="10.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="TypeCache" Version="10.0.1" />
<PackageReference Include="TypeCache" />
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 TypeCache --version 10.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: TypeCache, 10.0.1"
#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 TypeCache@10.0.1
#: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=TypeCache&version=10.0.1
#tool nuget:?package=TypeCache&version=10.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
TypeCache {$}
sam987883@gmail.com
Request Features (or report a bug) (if any)
TypeCache.Reflection - Faster Reflection
using TypeCache.Extensions;
using TypeCache.Reflection;
// Create an instance of Senator using the default constructor
var intance = typeof(Senator).Create();
// Create an instance of Customer using a matching constructor
var intance = Type<Senator>.Create(["Bob Dole", 98]); // Passing an array of values
var intance = typeof(Senator).Create(["Bob Dole", 98]); // Passing an array of values
var intance = Type<Senator>.Create(("Bob Dole", 98)); // Passing a tuple of strongly-typed values
var intance = typeof(Senator).Create(("Bob Dole", 98)); // Passing a tuple of strongly-typed values
// Find the matching ConstructorInfo object based on argument values
var comstructorEntity = Type<Senator>.Constructors.Find(["Bob Dole", 98]) // Passing an array of values
var comstructorEntity = typeof(Senator).Constructors.Find(["Bob Dole", 98]) // Passing an array of values
var comstructorEntity = Type<Senator>.Constructors.Find(("Bob Dole", 98)) // Passing a tuple of strongly-typed values
var comstructorEntity = typeof(Senator).Constructors.Find(("Bob Dole", 98)) // Passing a tuple of strongly-typed values
// Find a matching MethodInfo object based on argument values
var methodEntity = Type<Senator>.Methods["RunForPresident"].Find([typeof(int), typeof(bool)]); // Find method by argument types
var methodEntity = typeof(Senator).Methods["RunForPresident"].Find([typeof(int), typeof(bool)]); // Find method by argument types
var methodEntity = Type<Senator>.Methods["RunForPresident"].Find([1996, true]); // Passing an array of values
var methodEntity = typeof(Senator).Methods["RunForPresident"].Find([1996, true]); // Passing an array of values
var methodEntity = Type<Senator>.Methods["RunForPresident"].Find((1996, true)); // Passing a tuple of strongly-typed values
var methodEntity = typeof(Senator).Methods["RunForPresident"].Find((1996, true)); // Passing a tuple of strongly-typed values
// Get a field value
var fieldValue = Type<Senator>.Fields["_Bills"].GetValue(instance);
var fieldValue = typeof(Senator).Fields["_Bills"].GetValue(instance);
// Set a field value
Type<Senator>.Fields["_Bills"].SetValue(instance, 47);
typeof(Senator).Fields["_Bills"].SetValue(instance, 47);
var fieldEntity = Type<Senator>.Fields["_Bills"];
var fieldEntity = typeof(Senator).Fields["_Bills"];
fieldEntity.SetValue(instance, 47);
// Get a property value
var propertyValue = Type<Senator>.Properties["DoleWhip"].GetValue(instance);
var propertyValue = typeof(Senator).Properties["DoleWhip"].GetValue(instance);
var propertyEntity = Type<Senator>.Properties["DoleWhip"];
var propertyEntity = typeof(Senator).Properties["DoleWhip"];
var propertyValue = propertyEntity.GetValue(instance);
// Set a property value
Type<Senator>.Properties["DoleWhip"].SetValue(instance, Fruits.Pineapple);
typeof(Senator).Properties["DoleWhip"].SetValue(instance, Fruits.Pineapple);
var propertyEntity = Type<Senator>.Properties["DoleWhip"];
var propertyEntity = typeof(Senator).Properties["DoleWhip"];
propertyEntity.SetValueEx("DoleWhip", Fruits.Pineapple);
// Invoke a method
Type<Senator>.Methods["StopHillaryCare"].Invoke(instance, ["Oh noes", Action.Veto, false]); // Passing an array of values
typeof(Senator).Methods["StopHillaryCare"].Invoke(instance, ["Oh noes", Action.Veto, false]); // Passing an array of values
Type<Senator>.Methods["StopHillaryCare"].Invoke(instance, ("Oh noes", Action.Veto, false)); // Passing a tuple of strongly-typed values
typeof(Senator).Methods["StopHillaryCare"].Invoke(instance, ("Oh noes", Action.Veto, false)); // Passing a tuple of strongly-typed values
var state = Type<Senator>.Methods["GetState].Invoke(instance);
var state = typeof(Senator).Methods()["GetState].Invoke(instance);
TypeCache.Extensions - Better Object Mapping
using TypeCache.Extensions;
var dictionary = new Dictionary<string, object>(2)
{
{ "Name", "Bob Dole" },
{ "Age", 98 }
};
var bobDole1 = new Representative();
var bobDole2 = new Senator();
var bobDole3 = null as President;
dictionary.MapProperties(bobDole1); // Automatically maps dictionary entries to properties
dictionary.MapFields(bobDole2); // Automatically maps dictionary entries to fields
// To further customize mappings, use MapAttribute and MapIgnoreAttribute
TypeCache.Mediation - Mediator that supports named rules
using TypeCache.Mediation;
IMediator mediator; // Injected
var bobDoleRep = new Representative(); // Implements IRequest<Senator>
Senator bobDoleSen = mediator.Send(bobDoleRep); // Where bobDoleRep implements IRequest<Senator>
// Similar code with needing to implement IRequest<>
bobDoleSen = mediator.Request<Senator>().Send(bobDoleRep); // Where bobDoleRep does NOT need to implement IRequest<Senator>
mediator.Dispatch("Presidential Campaign", bobDole2);
President? bobDolePres = mediator.Send(nameof(President), bobDole2); // Send using named Rule
bobDolePres = mediator.Request<Senator>(nameof(President)).Send(bobDole2); // Send using named Rule without implementing IRequest<>
bobDolePres.AssertNotNull(); // Unhandled exception
TypeCache.Data - Simple Robust Database CRUD Access
TypeCache.Extensions - Helpful Extensions
using TypeCache.Extensions;
// Assertions
instance.AssertNotNull(); // Throws ArgumentNullException if instance is null
text.AssertNotBlank(); // Throws ArgumentException if text is null, empty or whitespaces
success.AssertTrue(); // Throws ArgumentException is success is not true (false or null)
// Action/Func Retry on fail
Action runForPresident;
runForPresident.Retry([TimeSpan.FromYears(4)]);
var timeSpan = runForPresident.Timed(); // Involes the Action and returns how long it took to run
// Comparable Extensions
IComparable<Senator> gingrich, bobDole;
var success = bobDole.CompareTo(gingrich) > 0; // Cryptic
success = bobDole.GreaterThan(gingrich); // More readable
// DateTime extensions
var bobDoleDOB = new DateOnly(1923, 7, 22);
// The following does not throw an exception as Between is inclusive of its endpoints.
bobDoleDOB.Between(new DateOnly(1923, 7, 22), new DateOnly(2021, 12, 5)).AssertTrue();
// The following throws an exception as InBetween is exclusive of its endpoints.
bobDoleDOB.InBetween(new DateOnly(1923, 7, 22), new DateOnly(2021, 12, 5)).AssertTrue();
var dateOnly = DateTime.UtcNow.ToDateOnly();
var dateTimeOffset = DateTime.UtcNow.ToDateTimeOffset();
var dateForUI = DateTime.UtcNow.ToISO8601();
var utcDateTime = DateTIme.Now.ToTimeZone(TimeZoneInfo.Utc)
utcDateTime = DateTIme.Now.ToUTC();
// JSON
JsonNode json;
// Access JSON nodes using JSON Path expression
var nodes = json.GetNodes("$.Politicians.Senators[1].*");
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net10.0
- Microsoft.Extensions.Caching.Abstractions (>= 10.0.0)
- Microsoft.Extensions.Configuration.Abstractions (>= 10.0.0)
- Microsoft.Extensions.DependencyInjection (>= 10.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.0)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on TypeCache:
| Package | Downloads |
|---|---|
|
TypeCache.GraphQL
An easier way to add endpoints to GraphQL: Attribute based GraphQL type generation. Simplified GraphQL DataLoader support. Automatic generation of SQL related endpoints. |
|
|
TypeCache.Web
Web API access to SQL database data operations: allows the front-end to decide how to retrieve and manipulate data. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 10.0.1 | 230 | 11/14/2025 |
| 10.0.0 | 285 | 11/13/2025 |
| 9.3.1 | 225 | 11/14/2025 |
| 9.3.0 | 296 | 11/13/2025 |
| 9.2.2 | 196 | 10/4/2025 |
| 9.2.1 | 207 | 9/29/2025 |
| 9.2.0 | 292 | 8/24/2025 |
| 9.1.2 | 200 | 4/25/2025 |
| 9.1.1 | 257 | 4/23/2025 |
| 9.1.0 | 179 | 2/23/2025 |
| 9.0.2 | 215 | 12/15/2024 |
| 9.0.1 | 180 | 12/6/2024 |
| 9.0.0 | 194 | 11/26/2024 |
| 8.6.2 | 209 | 10/4/2025 |
| 8.6.1 | 202 | 9/29/2025 |
| 8.6.0 | 301 | 8/24/2025 |
| 8.5.1 | 252 | 4/24/2025 |
| 8.5.0 | 193 | 2/24/2025 |
| 8.4.3 | 188 | 12/15/2024 |
| 8.4.2 | 182 | 12/6/2024 |
| 8.4.1 | 220 | 11/26/2024 |
| 8.4.0 | 247 | 10/28/2024 |
| 8.3.1 | 266 | 6/21/2024 |
| 8.3.0 | 252 | 4/17/2024 |
| 8.2.1 | 373 | 3/20/2024 |
| 8.2.0 | 337 | 3/19/2024 |
| 8.1.3 | 382 | 3/8/2024 |
| 8.1.2 | 591 | 1/31/2024 |
| 8.1.1 | 652 | 1/31/2024 |
| 8.1.0 | 638 | 1/31/2024 |
| 8.0.1 | 855 | 12/20/2023 |
| 8.0.0 | 1,099 | 12/11/2023 |
| 7.5.0 | 353 | 3/21/2024 |
| 7.4.1 | 1,007 | 11/12/2023 |
| 7.4.0 | 1,150 | 9/10/2023 |
| 7.3.14 | 1,221 | 8/13/2023 |
| 7.3.13 | 1,248 | 7/30/2023 |
| 7.3.12 | 1,282 | 7/17/2023 |
| 7.3.11 | 1,351 | 6/14/2023 |
| 7.3.10 | 1,450 | 3/19/2023 |
| 7.3.9 | 1,395 | 3/10/2023 |
| 7.3.8 | 1,419 | 3/10/2023 |
| 7.3.6 | 1,432 | 1/24/2023 |
| 7.3.5 | 1,470 | 1/22/2023 |
| 7.3.4 | 1,427 | 1/18/2023 |
| 7.3.3 | 1,448 | 1/17/2023 |
| 7.3.2 | 1,453 | 1/15/2023 |
| 7.3.1 | 1,480 | 1/11/2023 |
| 7.2.6 | 1,443 | 12/26/2022 |
| 7.2.5 | 1,508 | 12/26/2022 |
| 7.2.3 | 1,485 | 12/25/2022 |
| 7.2.2 | 1,699 | 12/25/2022 |
| 7.2.1 | 1,445 | 12/14/2022 |
| 7.2.0 | 1,555 | 12/14/2022 |
| 7.1.3 | 1,504 | 12/4/2022 |
| 7.1.2 | 1,475 | 11/27/2022 |
| 7.1.1 | 1,528 | 11/23/2022 |
| 7.1.0 | 1,500 | 11/21/2022 |
| 7.0.0 | 1,501 | 11/17/2022 |
| 6.3.2 | 1,421 | 3/19/2023 |
| 6.3.1 | 1,379 | 3/10/2023 |
| 6.3.0 | 1,471 | 2/1/2023 |
| 6.2.0 | 1,867 | 8/17/2022 |
| 6.1.3 | 1,791 | 4/20/2022 |
| 6.1.2 | 1,861 | 4/18/2022 |
| 6.1.1 | 1,855 | 3/27/2022 |
| 6.1.0 | 1,897 | 3/14/2022 |
| 6.0.9 | 1,715 | 3/7/2022 |
| 6.0.8 | 1,842 | 3/7/2022 |
| 6.0.7 | 1,473 | 1/8/2022 |
| 6.0.6 | 1,642 | 1/6/2022 |
| 6.0.5 | 1,505 | 1/4/2022 |
| 6.0.4 | 1,444 | 1/2/2022 |
| 6.0.3 | 1,672 | 1/1/2022 |
| 6.0.2 | 1,632 | 12/21/2021 |
| 6.0.1 | 2,633 | 11/28/2021 |
| 6.0.0 | 1,691 | 11/15/2021 |
| 1.0.67 | 1,673 | 10/24/2021 |
| 1.0.66 | 1,968 | 10/3/2021 |
| 1.0.65 | 1,854 | 9/11/2021 |
| 1.0.64 | 1,582 | 9/10/2021 |
| 1.0.63 | 1,682 | 9/4/2021 |
| 1.0.62 | 1,780 | 8/28/2021 |
| 1.0.61 | 1,854 | 8/15/2021 |
| 1.0.60 | 1,692 | 8/8/2021 |
| 1.0.59 | 1,568 | 8/2/2021 |
| 1.0.58 | 1,550 | 8/2/2021 |
| 1.0.57 | 1,715 | 8/1/2021 |
| 1.0.56 | 1,671 | 7/19/2021 |
| 1.0.55 | 1,514 | 7/18/2021 |
| 1.0.54 | 1,652 | 7/18/2021 |
| 1.0.53 | 1,590 | 7/18/2021 |
| 1.0.52 | 1,541 | 7/14/2021 |
| 1.0.51 | 1,582 | 7/11/2021 |
| 1.0.50 | 1,693 | 7/11/2021 |
| 1.0.49 | 1,610 | 7/2/2021 |
| 1.0.48 | 1,564 | 6/30/2021 |
| 1.0.47 | 1,749 | 6/30/2021 |
| 1.0.46 | 1,767 | 6/18/2021 |
| 1.0.45 | 1,567 | 6/12/2021 |
| 1.0.44 | 1,706 | 6/11/2021 |
| 1.0.43 | 1,734 | 6/10/2021 |
| 1.0.42 | 1,731 | 6/6/2021 |
| 1.0.41 | 1,648 | 6/5/2021 |
| 1.0.40 | 1,681 | 6/1/2021 |
| 1.0.39 | 1,696 | 5/31/2021 |
| 1.0.38 | 1,789 | 5/30/2021 |
| 1.0.37 | 1,660 | 5/30/2021 |
| 1.0.36 | 1,811 | 4/5/2021 |
| 1.0.35 | 1,804 | 3/28/2021 |
| 1.0.34 | 1,806 | 3/22/2021 |
| 1.0.33 | 1,616 | 3/18/2021 |
| 1.0.32 | 1,786 | 3/18/2021 |
| 1.0.31 | 1,640 | 3/17/2021 |
| 1.0.30 | 1,836 | 3/17/2021 |
| 1.0.29 | 1,739 | 3/9/2021 |
| 1.0.28 | 1,864 | 3/7/2021 |
| 1.0.27 | 1,885 | 3/1/2021 |
| 1.0.26 | 1,684 | 2/28/2021 |
| 1.0.25 | 1,650 | 2/26/2021 |
| 1.0.24 | 1,866 | 2/25/2021 |
| 1.0.23 | 1,790 | 2/24/2021 |
| 1.0.22 | 1,663 | 2/21/2021 |
| 1.0.21 | 1,732 | 2/20/2021 |
| 1.0.20 | 1,835 | 2/19/2021 |
| 1.0.19 | 1,648 | 2/2/2021 |
| 1.0.18 | 1,829 | 1/29/2021 |
| 1.0.17 | 1,911 | 1/28/2021 |
| 1.0.16 | 1,854 | 1/23/2021 |
| 1.0.15 | 2,078 | 12/26/2020 |
| 1.0.14 | 2,533 | 12/20/2020 |
| 1.0.13 | 2,399 | 12/20/2020 |
| 1.0.12 | 2,133 | 8/20/2020 |
| 1.0.11 | 2,149 | 8/7/2020 |
| 1.0.10 | 2,218 | 7/28/2020 |
| 1.0.9 | 2,246 | 7/28/2020 |
| 1.0.8 | 2,275 | 7/25/2020 |
| 1.0.7 | 2,255 | 7/21/2020 |
| 1.0.6 | 2,276 | 7/5/2020 |
| 1.0.5 | 2,324 | 7/5/2020 |
| 1.0.4 | 2,212 | 7/4/2020 |
| 1.0.3 | 2,244 | 7/3/2020 |
| 1.0.2 | 2,250 | 7/3/2020 |
| 1.0.1 | 2,283 | 7/2/2020 |
| 1.0.0 | 2,214 | 6/17/2020 |