Fixed checks for delegates with no captured variables

このコミットが含まれているのは:
Sergio Pedri committed 2019-09-05 17:10:16 +02:00
1 親 09eea2ddd5
コミット c1fe54c63e
2ファイル変更
+13 -2

検索条件に一致するファイルはありません

+9
ファイルの表示
@@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Diagnostics.Contracts;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
namespace ComputeSharp.Shaders.Extensions
@@ -20,6 +21,14 @@ namespace ComputeSharp.Shaders.Extensions
public static bool IsDelegate(this Type type) => type.IsClass &&
type.IsSubclassOf(typeof(Delegate));
/// <summary>
/// Gets whether or not the input <see cref="Type"/> represents a <see cref="Delegate"/> with no captured variables
/// </summary>
/// <param name="type">The input type to analyze</param>
[Pure]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool IsStatelessDelegateContainer(this Type type) => type.GetFields(BindingFlags.Static | BindingFlags.Public).Length > 0;
/// <summary>
/// The mapping of supported known types to display string
/// </summary>