mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-02-16 13:15:07 +00:00
Adding extension method to get Assembly for a given Type
This commit is contained in:
@@ -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)
|
||||||
|
|||||||
Reference in New Issue
Block a user