mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-04-12 12:07:05 +00:00
Adding extension method to get Assembly for a given Type
This commit is contained in:
parent
0345543aba
commit
cdaae0236f
1 changed files with 17 additions and 1 deletions
|
|
@ -1,5 +1,7 @@
|
||||||
using System;
|
using System;
|
||||||
#if STANDARD
|
#if SIMPLSHARP
|
||||||
|
using Crestron.SimplSharp.Reflection;
|
||||||
|
#else
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
#endif
|
#endif
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
@ -8,6 +10,20 @@ namespace ICD.Common.Utils.Extensions
|
||||||
{
|
{
|
||||||
public static class TypeExtensions
|
public static class TypeExtensions
|
||||||
{
|
{
|
||||||
|
public static Assembly GetAssembly(this Type extends)
|
||||||
|
{
|
||||||
|
if (extends == null)
|
||||||
|
throw new ArgumentNullException("extends");
|
||||||
|
|
||||||
|
return extends
|
||||||
|
#if SIMPLSHARP
|
||||||
|
.GetCType()
|
||||||
|
#else
|
||||||
|
.GetTypeInfo()
|
||||||
|
#endif
|
||||||
|
.Assembly;
|
||||||
|
}
|
||||||
|
|
||||||
public static bool IsAssignableTo(this Type from, Type to)
|
public static bool IsAssignableTo(this Type from, Type to)
|
||||||
{
|
{
|
||||||
if (from == null)
|
if (from == null)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue