Returns the public methods exposed by the current type matching specified name - CSharp System.Reflection

CSharp examples for System.Reflection:Type

Description

Returns the public methods exposed by the current type matching specified name

Demo Code

// Copyright (c) Costin Morariu. All rights reserved.
using System.Reflection;
using System.Collections.Generic;
using System;/*from  www.j  av a2s.com*/

public class Main{
        /// <summary>
        /// Returns the public methods exposed by the current type matching specified name
        /// </summary>
        /// <param name="type">Current type</param>
        /// <param name="name">The name of the methods</param>
        /// <returns>Matching method names</returns>
        public static IEnumerable<MethodInfo> GetMethods(this Type type, string name)
        {
            return type.GetTypeInfo().GetDeclaredMethods(name);
        }
}

Related Tutorials