Implemented working version of metaprogramming
このコミットが含まれているのは:
1 親
df02a534ea
コミット
c231e8506a
7ファイル変更
+74
-17
検索条件に一致するファイルはありません
@@ -0,0 +1,25 @@
|
||||
using System.Diagnostics.Contracts;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
|
||||
namespace ComputeSharp.Core.Extensions
|
||||
{
|
||||
/// <summary>
|
||||
/// A <see langword="class"/> that provides extension methods for the <see cref="MethodInfo"/> type.
|
||||
/// </summary>
|
||||
internal static class MethodInfoExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets a fully qualified name for the input method, including parameters.
|
||||
/// </summary>
|
||||
/// <param name="method">The input <see cref="MethodInfo"/> instance.</param>
|
||||
/// <returns>A fully qualified name for <paramref name="method"/>, including parameters.</returns>
|
||||
[Pure]
|
||||
public static string GetFullName(this MethodInfo method)
|
||||
{
|
||||
var parameters = string.Join(", ", method.GetParameters().Select(static p => p.ParameterType.FullName));
|
||||
|
||||
return $"{method.DeclaringType!.FullName}.{method.Name}({parameters})";
|
||||
}
|
||||
}
|
||||
}
|
||||
新しいイシューから参照
ユーザーをブロックする