From 39228f49b24cef6a40f5ea3461c2133a40207d6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Sim=C3=B5es?= Date: Thu, 18 Sep 2025 13:21:47 +0100 Subject: [PATCH] Add `ByRefLikeGenerics` to runtime features --- .../Runtime/CompilerServices/RuntimeFeature.cs | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/nanoFramework.CoreLibrary/System/Runtime/CompilerServices/RuntimeFeature.cs b/nanoFramework.CoreLibrary/System/Runtime/CompilerServices/RuntimeFeature.cs index a5f408a5..8d1bdf58 100644 --- a/nanoFramework.CoreLibrary/System/Runtime/CompilerServices/RuntimeFeature.cs +++ b/nanoFramework.CoreLibrary/System/Runtime/CompilerServices/RuntimeFeature.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. namespace System.Runtime.CompilerServices @@ -13,17 +13,22 @@ public static partial class RuntimeFeature /// public const string DefaultImplementationsOfInterfaces = nameof(DefaultImplementationsOfInterfaces); + /// + /// Represents a runtime feature where byref-like types can be used in Generic parameters. + /// + public const string ByRefLikeGenerics = nameof(ByRefLikeGenerics); + /// /// Checks whether a certain feature is supported by the Runtime. /// public static bool IsSupported(string feature) { - if (feature == DefaultImplementationsOfInterfaces) + return feature switch { - return true; - } - - return false; + ByRefLikeGenerics or + DefaultImplementationsOfInterfaces => true, + _ => false, + }; } } }