From 210a6845104405c8801fa2136c3405cbe752bda3 Mon Sep 17 00:00:00 2001 From: Theodore Tsirpanis Date: Sun, 6 Apr 2025 20:28:19 +0300 Subject: [PATCH] Type-forward `IsExternalInit` on .NET 5+. --- src/IsExternalInit/IsExternalInit.cs | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/IsExternalInit/IsExternalInit.cs b/src/IsExternalInit/IsExternalInit.cs index 1ddfea7..b189591 100644 --- a/src/IsExternalInit/IsExternalInit.cs +++ b/src/IsExternalInit/IsExternalInit.cs @@ -14,19 +14,19 @@ #region License // MIT License -// +// // Copyright (c) Manuel Römer -// +// // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: -// +// // The above copyright notice and this permission notice shall be included in all // copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -40,6 +40,7 @@ #nullable enable #pragma warning disable +#if !NET5_0_OR_GREATER namespace System.Runtime.CompilerServices { using global::System.Diagnostics; @@ -60,6 +61,13 @@ internal static class IsExternalInit { } } +#else +using System.Runtime.CompilerServices; + +// Type-forward to the inbox IsExternalInit in order to maintain binary compatibility when +// multitargeting. +[assembly:TypeForwardedTo(typeof(IsExternalInit))] +#endif #pragma warning restore #nullable restore