Determines if the type is derived from the given base type. : Base Type « Reflection « C# / C Sharp






Determines if the type is derived from the given base type.

 

//Microsoft Public License (Ms-PL)
//http://visualizer.codeplex.com/license

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Redwerb.BizArk.Core.TypeExt
{
    /// <summary>
    /// Provides extension methods for Type.
    /// </summary>
    public static class TypeExt
    {


        /// <summary>
        /// Determines if the type is derived from the given base type.
        /// </summary>
        /// <param name="type"></param>
        /// <param name="baseType"></param>
        /// <returns></returns>
        public static bool IsDerivedFrom(this Type type, Type baseType)
        {
             return baseType.IsAssignableFrom(type);
        }
   }
}

   
  








Related examples in the same category

1.using the BaseType property.