Whitespace

This commit is contained in:
Chris Cameron
2017-09-27 13:49:13 -04:00
parent ac885e9837
commit d598d42cff
14 changed files with 174 additions and 183 deletions

View File

@@ -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);
}
}
}