Returns interfaces implemented by the current type - CSharp System.Reflection

CSharp examples for System.Reflection:Type

Description

Returns interfaces implemented by the current type

Demo Code

// Copyright (c) Costin Morariu. All rights reserved.
using System.Reflection;
using System.Collections.Generic;
using System;/*from   w  ww  . java 2  s.  co m*/

public class Main{
        /// <summary>
        /// Returns interfaces implemented by the current type
        /// </summary>
        /// <param name="type">Current type</param>
        /// <returns>The types of the interfaces</returns>
        public static IEnumerable<Type> GetInterfaces(this Type type)
        {
            return type.GetTypeInfo().ImplementedInterfaces;
        }
}

Related Tutorials