using System;
|
using System.Collections.Generic;
|
using System.Linq;
|
using System.Reflection;
|
using System.Text;
|
using System.Threading.Tasks;
|
|
namespace WIDESEA_Core.Helper
|
{
|
public static class MethodInfoExtensions
|
{
|
/// <summary>
|
/// 获取方法的完整名称,包括声明类型的全名和方法名
|
/// </summary>
|
/// <param name="method">要获取完整名称的方法信息</param>
|
/// <returns>返回格式为"声明类型全名.方法名"的字符串,如果声明类型为空则只返回方法名</returns>
|
public static string GetFullName(this MethodInfo method)
|
{
|
if (method.DeclaringType == null)
|
{
|
return $@"{method.Name}";
|
}
|
|
return $"{method.DeclaringType.FullName}.{method.Name}";
|
}
|
}
|
}
|