Shuttle.Core.Reflection
21.0.1-beta
Prefix Reserved
This is a prerelease version of Shuttle.Core.Reflection.
dotnet add package Shuttle.Core.Reflection --version 21.0.1-beta
NuGet\Install-Package Shuttle.Core.Reflection -Version 21.0.1-beta
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="Shuttle.Core.Reflection" Version="21.0.1-beta" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Shuttle.Core.Reflection" Version="21.0.1-beta" />
<PackageReference Include="Shuttle.Core.Reflection" />
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 Shuttle.Core.Reflection --version 21.0.1-beta
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Shuttle.Core.Reflection, 21.0.1-beta"
#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 Shuttle.Core.Reflection@21.0.1-beta
#: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=Shuttle.Core.Reflection&version=21.0.1-beta&prerelease
#tool nuget:?package=Shuttle.Core.Reflection&version=21.0.1-beta&prerelease
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Shuttle.Core.Reflection
Provides various methods to facilitate reflection handling.
Installation
dotnet add package Shuttle.Core.Reflection
Assembly Extensions
Task<IEnumerable<Type>> GetTypesCastableToAsync(this Assembly assembly, Type type)
Task<IEnumerable<Type>> GetTypesCastableToAsync<T>(this Assembly assembly)
GetTypesCastableToAsync: Returns all the types in the givenassemblythat can be cast to thetypeortypeof(T).
Assembly Static Extensions
Task<IEnumerable<Assembly>> GetRuntimeAssembliesAsync()
Task<IEnumerable<Type>> GetTypesCastableToAsync(Type type)
Task<IEnumerable<Type>> GetTypesCastableToAsync<T>()
GetRuntimeAssembliesAsync: Returns a combination ofDependencyContext.Default.GetRuntimeAssemblyNames(Environment.OSVersion.Platform.ToString())andAppDomain.CurrentDomain.GetAssemblies().GetTypesCastableToAsync: Returns all the types in all assemblies returned byGetRuntimeAssembliesAsync()that can be cast to thetypeortypeof(T).
Enumerable Extensions
T? Find<T>(this IEnumerable<object> list) where T : class
IEnumerable<T> FindAll<T>(this IEnumerable<object> list) where T : class
T Get<T>(this IEnumerable<object> list) where T : class
Find<T>: Returns the single instance of typeTfrom thelist. Throws an exception if more than one instance is found. Returnsnullif no instance is found.FindAll<T>: Returns all instances of typeTfrom thelist.Get<T>: Returns the single instance of typeTfrom thelist. Throws an exception if more than one instance is found or if no instance is found.
Exception Extensions
string AllMessages(this Exception ex)
bool Contains<T>(this Exception ex) where T : Exception
T? Find<T>(this Exception ex) where T : Exception
Exception TrimLeading<T>(this Exception ex) where T : Exception
AllMessages: Traverses the exception and its inner exceptions to concatenate all messages.Contains<T>: Determines whether the exception or any of its inner exceptions are of typeT.Find<T>: Returns the first exception of typeTfound in the exception chain.TrimLeading<T>: Removes the outer exception(s) if they are of typeTand returns the inner exception.
Object Extensions
void TryDispose(this object o)
Task TryDisposeAsync(this object o)
TryDispose: Attempts to cast the object toIDisposableand callsDisposeif successful.TryDisposeAsync: Attempts to cast the object toIAsyncDisposableand callsDisposeAsync. If not implemented, falls back toTryDispose.
Type Extensions
void AssertDefaultConstructor(this Type type)
void AssertDefaultConstructor(this Type type, string message)
Type? FirstInterface(this Type type, Type of)
Type? GetGenericArgument(this Type type, Type generic)
bool HasDefaultConstructor(this Type type)
Type? InterfaceMatching(this Type type, string includeRegexPattern, string? excludeRegexPattern = null)
IEnumerable<Type> InterfacesCastableTo<T>(this Type type)
IEnumerable<Type> InterfacesCastableTo(this Type type, Type interfaceType)
bool IsCastableTo(this Type type, Type otherType)
Type? MatchingInterface(this Type type)
AssertDefaultConstructor: Throws an exception if the type does not have a default constructor.FirstInterface: Returns the first interface that matches the naming conventionI{TypeName}or is castable to the specified type.GetGenericArgument: Returns the generic argument for the specified generic type definition.HasDefaultConstructor: Determines whether the type has a default constructor.InterfaceMatching: Returns the first interface matching the include regex and not matching the exclude regex.InterfacesCastableTo: Returns all interfaces implemented by the type that are castable to the specified type.IsCastableTo: Determines whether the type is castable to theotherType.MatchingInterface: Returns the interface that matches the naming conventionI{TypeName}.
| 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.DependencyModel (>= 10.0.1)
- Shuttle.Core.Contract (>= 21.0.1-beta)
NuGet packages (12)
Showing the top 5 NuGet packages that depend on Shuttle.Core.Reflection:
| Package | Downloads |
|---|---|
|
Shuttle.Esb
Contains the core Shuttle.Esb assembly that should always be referenced when building Shuttle.Esb solutions. |
|
|
Shuttle.Core.Container
Dependency injection container adapter. |
|
|
Shuttle.Core.Threading
Thread-based processing. |
|
|
Shuttle.Core.Pipelines
Observable event-based pipelines based broadly on pipes and filters. |
|
|
Shuttle.Recall
Event sourcing mechanism. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 21.0.1-beta | 146 | 2/7/2026 |
| 21.0.0-alpha | 131 | 1/18/2026 |
| 20.0.0 | 6,655 | 2/2/2025 |
| 13.0.0 | 7,497 | 4/30/2024 |
| 12.0.1 | 18,509 | 12/1/2022 |
| 12.0.0 | 31,001 | 9/4/2022 |
| 11.0.3 | 30,402 | 4/9/2022 |
| 11.0.2 | 26,860 | 2/1/2021 |
| 11.0.0 | 18,839 | 1/17/2021 |
| 10.0.11 | 9,908 | 11/27/2020 |
| 10.0.10 | 119,748 | 9/19/2018 |
| 10.0.9 | 18,989 | 7/8/2018 |
| 10.0.7 | 2,461 | 2/17/2018 |
| 10.0.6 | 38,234 | 2/13/2018 |
Loading failed