Skip to content

Commit cc0939b

Browse files
committed
- v10.0.7
1 parent 9b12e10 commit cc0939b

File tree

4 files changed

+65
-6
lines changed

4 files changed

+65
-6
lines changed

README.md

Lines changed: 60 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,64 @@
11
# Shuttle.Core.Reflection
22

3+
```
4+
PM> Install-Package Shuttle.Core.Autofac
5+
```
6+
7+
Provides various methods to facilitate reflection handling.
8+
39
## ReflectionService
410

5-
Provides various methods to facilitate reflection handling.
11+
``` c#
12+
string AssemblyPath(Assembly assembly)
13+
```
14+
15+
Returns the path to the given assembly.
16+
17+
``` c#
18+
Assembly FindAssemblyNamed(string name)
19+
```
20+
21+
Returns the `Assembly` that has the requested `name`; else `null`.
22+
23+
``` c#
24+
IEnumerable<Assembly> GetAssemblies()
25+
```
26+
27+
Returns all runtime assemblies as well as those in the `AppDomain.CurrentDomain.BaseDirectory` and `AppDomain.CurrentDomain.RelativeSearchPath`.
28+
29+
``` c#
30+
IEnumerable<Assembly> GetAssemblies(string folder)
31+
```
32+
33+
Returns a collection of all assemblies located in the given folder.
34+
35+
``` c#
36+
Assembly GetAssembly(string assemblyPath)
37+
```
38+
39+
Returns the requested assembly if found; else `null`.
40+
41+
``` c#
42+
IEnumerable<Assembly> GetMatchingAssemblies(string regex)
43+
```
44+
45+
Returns a collection of assemblies that have their file name matching the given `Regex` expression.
46+
47+
``` c#
48+
IEnumerable<Assembly> GetMatchingAssemblies(string regex, string folder)
49+
```
50+
51+
Returns a collection of assemblies in the given `folder` that have their file name matching the given `regex` expression.
52+
53+
``` c#
54+
IEnumerable<Assembly> GetRuntimeAssemblies()
55+
```
56+
57+
For .Net 4.6+ returns `AppDomain.CurrentDomain.GetAssemblies();`. For .Net Core 2.0+ all the `DependencyContext.Default.GetRuntimeAssemblyNames(RuntimeEnvironment.GetRuntimeIdentifier())` assembly names are resolved.
58+
59+
``` c#
60+
IEnumerable<Type> GetTypes(Assembly assembly)
61+
```
62+
63+
Returns all types in the given `assembly`.
64+

Shuttle.Core.Reflection/IReflectionService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public interface IReflectionService
1616
IEnumerable<Assembly> GetRuntimeAssemblies();
1717
IEnumerable<Type> GetTypesAssignableTo<T>();
1818
IEnumerable<Type> GetTypesAssignableTo(Type type);
19-
IEnumerable<Type> GetTypesAssignableTo(Assembly assembly);
19+
IEnumerable<Type> GetTypes(Assembly assembly);
2020
IEnumerable<Type> GetTypesAssignableTo<T>(Assembly assembly);
2121
IEnumerable<Type> GetTypesAssignableTo(Type type, Assembly assembly);
2222
}

Shuttle.Core.Reflection/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@
2929
[assembly: AssemblyTitle(".NET Standard 2.0")]
3030
#endif
3131

32-
[assembly: AssemblyVersion("10.0.6.0")]
32+
[assembly: AssemblyVersion("10.0.7.0")]
3333
[assembly: AssemblyCopyright("Copyright © Eben Roux 2017")]
3434
[assembly: AssemblyProduct("Shuttle.Core.Reflection")]
3535
[assembly: AssemblyCompany("Shuttle")]
3636
[assembly: AssemblyConfiguration("Release")]
37-
[assembly: AssemblyInformationalVersion("10.0.6")]
37+
[assembly: AssemblyInformationalVersion("10.0.7")]
3838
[assembly: ComVisible(false)]

Shuttle.Core.Reflection/ReflectionService.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,10 +263,10 @@ public IEnumerable<Type> GetTypesAssignableTo(Type type, Assembly assembly)
263263
Guard.AgainstNull(type, nameof(type));
264264
Guard.AgainstNull(assembly, nameof(assembly));
265265

266-
return GetTypesAssignableTo(assembly).Where(candidate => candidate.IsAssignableTo(type) && !(candidate.IsInterface && candidate == type)).ToList();
266+
return GetTypes(assembly).Where(candidate => candidate.IsAssignableTo(type) && !(candidate.IsInterface && candidate == type)).ToList();
267267
}
268268

269-
public IEnumerable<Type> GetTypesAssignableTo(Assembly assembly)
269+
public IEnumerable<Type> GetTypes(Assembly assembly)
270270
{
271271
Type[] types;
272272

0 commit comments

Comments
 (0)