Get Full Member Name from MemberInfo - CSharp System.Reflection

CSharp examples for System.Reflection:MethodInfo

Description

Get Full Member Name from MemberInfo

Demo Code


using System.Reflection;
using System.Linq;
using System.Collections.Generic;
using System;/* ww w  . j av  a 2  s . co m*/

public class Main{
        public static string GetFullMemberName(this MemberInfo member)
      {
         var str = member.DeclaringType.FullName + "." + member.Name;
         if (member is MethodInfo)
         {
            str += "(" + ((MethodInfo)member).GetParameters().ToString(", ", (param) => param.ParameterType.Name) + (")");
         }
         return str;
      }
}

Related Tutorials