|
|
|
@ -6,5 +6,30 @@
|
|
|
|
|
{
|
|
|
|
|
return type.FullName + ", " + type.Assembly.GetName().Name;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Determines whether an instance of this type can be assigned to
|
|
|
|
|
/// an instance of the <typeparamref name="TTarget"></typeparamref>.
|
|
|
|
|
///
|
|
|
|
|
/// Internally uses <see cref="Type.IsAssignableFrom"/>.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <typeparam name="TTarget">Target type</typeparam> (as reverse).
|
|
|
|
|
public static bool IsAssignableTo<TTarget>(this Type type)
|
|
|
|
|
{
|
|
|
|
|
return type.IsAssignableTo(typeof(TTarget));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Determines whether an instance of this type can be assigned to
|
|
|
|
|
/// an instance of the <paramref name="targetType"></paramref>.
|
|
|
|
|
///
|
|
|
|
|
/// Internally uses <see cref="Type.IsAssignableFrom"/> (as reverse).
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="type">this type</param>
|
|
|
|
|
/// <param name="targetType">Target type</param>
|
|
|
|
|
public static bool IsAssignableTo(this Type type, Type targetType)
|
|
|
|
|
{
|
|
|
|
|
return targetType.IsAssignableFrom(type);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|