Unity Udexreal开发插件包
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
1.2 KiB

using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
namespace TouchSocket.Core
{
/// <summary>
/// 元组扩展
/// </summary>
public static class TupleExtension
{
/// <summary>
/// 获取元组的名称列表。
/// </summary>
/// <param name="parameter"></param>
/// <returns></returns>
public static IEnumerable<string> GetTupleElementNames(this ParameterInfo parameter)
{
return ((dynamic)parameter.GetCustomAttribute(Type.GetType("System.Runtime.CompilerServices.TupleElementNamesAttribute")))?.TransformNames;
}
/// <summary>
/// 获取元组的名称列表。
/// </summary>
/// <param name="memberInfo"></param>
/// <returns></returns>
public static IEnumerable<string> GetTupleElementNames(this MemberInfo memberInfo)
{
return ((dynamic)memberInfo.GetCustomAttribute(Type.GetType("System.Runtime.CompilerServices.TupleElementNamesAttribute")))?.TransformNames;
}
}
}