CSharp examples for System.Reflection:Type
Returns a value that indicates whether current type can be assigned to specified type
// Copyright (c) Costin Morariu. All rights reserved. using System.Reflection; using System.Collections.Generic; using System;/* w ww .j a v a 2 s. c o m*/ public class Main{ /// <summary> /// Returns a value that indicates whether current type can be assigned to specified type /// </summary> /// <param name="type">Current type</param> /// <param name="baseType">The type that supports the assignment</param> /// <returns>True if the assignment is possible, otherwise false</returns> public static bool IsAssignableFrom(this Type type, Type baseType) { return type.GetTypeInfo().IsAssignableFrom(baseType.GetTypeInfo()); } }