mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-02-11 18:54:55 +00:00
Whitespace
This commit is contained in:
@@ -6,59 +6,59 @@ using System.Collections.Generic;
|
||||
|
||||
namespace ICD.Common.Utils.Extensions
|
||||
{
|
||||
public static class TypeExtensions
|
||||
{
|
||||
public static bool IsAssignableTo(this Type from, Type to)
|
||||
{
|
||||
if (from == null)
|
||||
throw new ArgumentNullException("from");
|
||||
public static class TypeExtensions
|
||||
{
|
||||
public static bool IsAssignableTo(this Type from, Type to)
|
||||
{
|
||||
if (from == null)
|
||||
throw new ArgumentNullException("from");
|
||||
|
||||
if (to == null)
|
||||
throw new ArgumentNullException("to");
|
||||
if (to == null)
|
||||
throw new ArgumentNullException("to");
|
||||
|
||||
return to.IsAssignableFrom(from);
|
||||
}
|
||||
return to.IsAssignableFrom(from);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the given type, all base types, and all implemented interfaces.
|
||||
/// </summary>
|
||||
/// <param name="extends"></param>
|
||||
/// <returns></returns>
|
||||
public static IEnumerable<Type> GetAllTypes(this Type extends)
|
||||
{
|
||||
if (extends == null)
|
||||
throw new ArgumentNullException("extends");
|
||||
/// <summary>
|
||||
/// Returns the given type, all base types, and all implemented interfaces.
|
||||
/// </summary>
|
||||
/// <param name="extends"></param>
|
||||
/// <returns></returns>
|
||||
public static IEnumerable<Type> GetAllTypes(this Type extends)
|
||||
{
|
||||
if (extends == null)
|
||||
throw new ArgumentNullException("extends");
|
||||
|
||||
yield return extends;
|
||||
yield return extends;
|
||||
|
||||
foreach (Type type in extends.GetBaseTypes())
|
||||
yield return type;
|
||||
foreach (Type type in extends.GetBaseTypes())
|
||||
yield return type;
|
||||
|
||||
foreach (Type type in extends.GetInterfaces())
|
||||
yield return type;
|
||||
}
|
||||
foreach (Type type in extends.GetInterfaces())
|
||||
yield return type;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns all base types for the given type.
|
||||
/// </summary>
|
||||
/// <param name="extends"></param>
|
||||
/// <returns></returns>
|
||||
public static IEnumerable<Type> GetBaseTypes(this Type extends)
|
||||
{
|
||||
if (extends == null)
|
||||
throw new ArgumentNullException("extends");
|
||||
/// <summary>
|
||||
/// Returns all base types for the given type.
|
||||
/// </summary>
|
||||
/// <param name="extends"></param>
|
||||
/// <returns></returns>
|
||||
public static IEnumerable<Type> GetBaseTypes(this Type extends)
|
||||
{
|
||||
if (extends == null)
|
||||
throw new ArgumentNullException("extends");
|
||||
|
||||
do
|
||||
{
|
||||
extends = extends
|
||||
do
|
||||
{
|
||||
extends = extends
|
||||
#if !SIMPLSHARP
|
||||
.GetTypeInfo()
|
||||
#endif
|
||||
.BaseType;
|
||||
.BaseType;
|
||||
|
||||
if (extends != null)
|
||||
yield return extends;
|
||||
} while (extends != null);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (extends != null)
|
||||
yield return extends;
|
||||
} while (extends != null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user