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" />
                    
Directory.Packages.props
<PackageReference Include="Shuttle.Core.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 Shuttle.Core.Reflection --version 21.0.1-beta
                    
#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
                    
Install as a Cake Addin
#tool nuget:?package=Shuttle.Core.Reflection&version=21.0.1-beta&prerelease
                    
Install as a Cake Tool

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 given assembly that can be cast to the type or typeof(T).

Assembly Static Extensions

Task<IEnumerable<Assembly>> GetRuntimeAssembliesAsync()
Task<IEnumerable<Type>> GetTypesCastableToAsync(Type type)
Task<IEnumerable<Type>> GetTypesCastableToAsync<T>()
  • GetRuntimeAssembliesAsync: Returns a combination of DependencyContext.Default.GetRuntimeAssemblyNames(Environment.OSVersion.Platform.ToString()) and AppDomain.CurrentDomain.GetAssemblies().
  • GetTypesCastableToAsync: Returns all the types in all assemblies returned by GetRuntimeAssembliesAsync() that can be cast to the type or typeof(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 type T from the list. Throws an exception if more than one instance is found. Returns null if no instance is found.
  • FindAll<T>: Returns all instances of type T from the list.
  • Get<T>: Returns the single instance of type T from the list. 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 type T.
  • Find<T>: Returns the first exception of type T found in the exception chain.
  • TrimLeading<T>: Removes the outer exception(s) if they are of type T and returns the inner exception.

Object Extensions

void TryDispose(this object o)
Task TryDisposeAsync(this object o)
  • TryDispose: Attempts to cast the object to IDisposable and calls Dispose if successful.
  • TryDisposeAsync: Attempts to cast the object to IAsyncDisposable and calls DisposeAsync. If not implemented, falls back to TryDispose.

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 convention I{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 the otherType.
  • MatchingInterface: Returns the interface that matches the naming convention I{TypeName}.
Product 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.

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