An open API service indexing awesome lists of open source software.

https://github.com/shuttle/shuttle.core.reflection

Reflection infrastructure components.
https://github.com/shuttle/shuttle.core.reflection

Last synced: about 1 month ago
JSON representation

Reflection infrastructure components.

Awesome Lists containing this project

README

        

# Shuttle.Core.Reflection

```
PM> Install-Package Shuttle.Core.Reflection
```

Provides various methods to facilitate reflection handling.

## ReflectionService

``` c#
Task> GetMatchingAssembliesAsync(Regex regex)
```

Returns a collection of assemblies that have their file name matching the given `Regex` expression.

``` c#
Task> GetRuntimeAssembliesAsync()
```

Returns a combination of `DependencyContext.Default.GetRuntimeAssemblyNames(Environment.OSVersion.Platform.ToString())` and `AppDomain.CurrentDomain.GetAssemblies()`.

``` c#
Task GetTypeAsync(string typeName)
```

Attempts to find the requested type.

``` c#
Task> GetTypesCastableToAsync(Type type, Assembly assembly)
// and these extensions
Task> GetTypesCastableToAsync();
Task> GetTypesCastableToAsync(Type type);
Task> GetTypesCastableToAsync(Assembly assembly);
```

Returns all the types in the given `assembly` that can be cast to the `type` or `typeof(T)`; if no `assembly` is provided the all assemblies returned by `GetAssembliesAsync()` will be scanned.