From 3e0072a80c14fcbaa365dbb7dc541fecd5e90e1b Mon Sep 17 00:00:00 2001 From: Simon Cropp Date: Fri, 9 Aug 2024 12:06:42 +1000 Subject: [PATCH] move types out of the global namespace (#204) --- contributing.md | 3 ++- src/Polyfill/EnumPolyfill.cs | 1 + src/Polyfill/GuidPolyfill.cs | 2 +- src/Polyfill/Nullability/NullabilityInfoContext.cs | 5 ++--- src/Polyfill/Nullability/NullabilityInfoExtensions.cs | 1 + src/Polyfill/Numbers/BytePolyfill.cs | 1 + src/Polyfill/Numbers/DoublePolyfill.cs | 1 + src/Polyfill/Numbers/IntPolyfill.cs | 1 + src/Polyfill/Numbers/LongPolyfill.cs | 1 + src/Polyfill/Numbers/SBytePolyfill.cs | 1 + src/Polyfill/Numbers/ShortPolyfill.cs | 1 + src/Polyfill/Numbers/UIntPolyfill.cs | 1 + src/Polyfill/Numbers/ULongPolyfill.cs | 1 + src/Polyfill/Numbers/UShortPolyfill.cs | 1 + src/Polyfill/Polyfill.cs | 3 +++ src/Polyfill/Polyfill_CancellationToken.cs | 1 + src/Polyfill/Polyfill_CancellationTokenSource.cs | 1 + src/Polyfill/Polyfill_ConcurrentDictionary.cs | 1 + src/Polyfill/Polyfill_Dictionary.cs | 1 + src/Polyfill/Polyfill_HashSet.cs | 1 + src/Polyfill/Polyfill_HttpClient.cs | 1 + src/Polyfill/Polyfill_HttpContent.cs | 1 + src/Polyfill/Polyfill_IEnumerable.cs | 1 + src/Polyfill/Polyfill_IEnumerable_AggregateBy.cs | 1 + src/Polyfill/Polyfill_IEnumerable_Chunk.cs | 1 + src/Polyfill/Polyfill_IEnumerable_CountBy.cs | 1 + src/Polyfill/Polyfill_IEnumerable_DistinctBy.cs | 1 + src/Polyfill/Polyfill_IEnumerable_ElementAt.cs | 1 + src/Polyfill/Polyfill_IEnumerable_Except.cs | 1 + src/Polyfill/Polyfill_IEnumerable_FirstOrDefault.cs | 1 + src/Polyfill/Polyfill_IEnumerable_LastOrDefault.cs | 1 + src/Polyfill/Polyfill_IEnumerable_MaxBy.cs | 1 + src/Polyfill/Polyfill_IEnumerable_MinBy.cs | 1 + src/Polyfill/Polyfill_IEnumerable_SingleOrDefault.cs | 1 + src/Polyfill/Polyfill_IEnumerable_Zip.cs | 1 + src/Polyfill/Polyfill_IReadOnlyDictionary.cs | 1 + src/Polyfill/Polyfill_KeyValuePair.cs | 1 + src/Polyfill/Polyfill_List.cs | 2 +- src/Polyfill/Polyfill_Memory.cs | 1 + src/Polyfill/Polyfill_MicroNanosecond.cs | 1 + src/Polyfill/Polyfill_MicroNanosecondAdd.cs | 1 + src/Polyfill/Polyfill_Process.cs | 1 + src/Polyfill/Polyfill_Random.cs | 1 + src/Polyfill/Polyfill_SortedList.cs | 1 + src/Polyfill/Polyfill_Stream.cs | 1 + src/Polyfill/Polyfill_String.cs | 1 + src/Polyfill/Polyfill_StringBuilder.cs | 1 + src/Polyfill/Polyfill_Task.cs | 1 + src/Polyfill/Polyfill_TaskCompletionSource.cs | 1 + src/Polyfill/Polyfill_TextReader.cs | 1 + src/Polyfill/Polyfill_TextWriter.cs | 1 + src/Polyfill/Polyfill_TryFormat.cs | 1 + src/Polyfill/Polyfill_Type.cs | 1 + src/Polyfill/Polyfill_XDocument.cs | 1 + src/Polyfill/Regex/Polyfill_Regex.cs | 2 +- src/Polyfill/Regex/RegexPolyfill.cs | 1 + src/Polyfill/StringPolyfill.cs | 1 + src/TargetFrameworkUsage/FakePolyfillsNamespace.cs | 3 +++ src/Tests/GuardTests.cs | 4 +--- 59 files changed, 65 insertions(+), 10 deletions(-) create mode 100644 src/TargetFrameworkUsage/FakePolyfillsNamespace.cs diff --git a/contributing.md b/contributing.md index 8360bee6..dc7c005f 100644 --- a/contributing.md +++ b/contributing.md @@ -191,6 +191,7 @@ Example: #if FeatureMemory && (NETFRAMEWORK || NETSTANDARD2_0 || NETCOREAPP2_0) +namespace Polyfills; using System; using System.Buffers; using System.IO; @@ -306,7 +307,7 @@ static partial class Polyfill } #endif ``` -snippet source | anchor +snippet source | anchor diff --git a/src/Polyfill/EnumPolyfill.cs b/src/Polyfill/EnumPolyfill.cs index c6540ca2..dcc9f87b 100644 --- a/src/Polyfill/EnumPolyfill.cs +++ b/src/Polyfill/EnumPolyfill.cs @@ -1,6 +1,7 @@ // #pragma warning disable +namespace Polyfills; using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; diff --git a/src/Polyfill/GuidPolyfill.cs b/src/Polyfill/GuidPolyfill.cs index 0934b775..f007cdc0 100644 --- a/src/Polyfill/GuidPolyfill.cs +++ b/src/Polyfill/GuidPolyfill.cs @@ -3,7 +3,7 @@ // ReSharper disable RedundantUsingDirective // ReSharper disable PartialTypeWithSinglePart - +namespace Polyfills; using System; using System.Collections.Generic; using System.Diagnostics; diff --git a/src/Polyfill/Nullability/NullabilityInfoContext.cs b/src/Polyfill/Nullability/NullabilityInfoContext.cs index a4ecb0e8..f9efdc85 100644 --- a/src/Polyfill/Nullability/NullabilityInfoContext.cs +++ b/src/Polyfill/Nullability/NullabilityInfoContext.cs @@ -5,6 +5,8 @@ #nullable enable + +namespace System.Reflection; using System.Linq; using System.Diagnostics.CodeAnalysis; @@ -14,9 +16,6 @@ using System.Collections.Generic; using System.Collections.ObjectModel; using System.Diagnostics; - -namespace System.Reflection; - using System.Linq; using System.Diagnostics.CodeAnalysis; using System.Collections.Generic; diff --git a/src/Polyfill/Nullability/NullabilityInfoExtensions.cs b/src/Polyfill/Nullability/NullabilityInfoExtensions.cs index af8e84bd..4cbb62b6 100644 --- a/src/Polyfill/Nullability/NullabilityInfoExtensions.cs +++ b/src/Polyfill/Nullability/NullabilityInfoExtensions.cs @@ -3,6 +3,7 @@ #nullable enable +namespace Polyfills; using System; using System.Collections.Concurrent; using System.Reflection; diff --git a/src/Polyfill/Numbers/BytePolyfill.cs b/src/Polyfill/Numbers/BytePolyfill.cs index 464ecb22..2d6b71f8 100644 --- a/src/Polyfill/Numbers/BytePolyfill.cs +++ b/src/Polyfill/Numbers/BytePolyfill.cs @@ -4,6 +4,7 @@ // ReSharper disable RedundantUsingDirective // ReSharper disable PartialTypeWithSinglePart +namespace Polyfills; using System; using System.Collections.Generic; using System.Diagnostics; diff --git a/src/Polyfill/Numbers/DoublePolyfill.cs b/src/Polyfill/Numbers/DoublePolyfill.cs index 7efab81c..358f9690 100644 --- a/src/Polyfill/Numbers/DoublePolyfill.cs +++ b/src/Polyfill/Numbers/DoublePolyfill.cs @@ -4,6 +4,7 @@ // ReSharper disable RedundantUsingDirective // ReSharper disable PartialTypeWithSinglePart +namespace Polyfills; using System; using System.Collections.Generic; using System.Diagnostics; diff --git a/src/Polyfill/Numbers/IntPolyfill.cs b/src/Polyfill/Numbers/IntPolyfill.cs index a5da2863..244ec1de 100644 --- a/src/Polyfill/Numbers/IntPolyfill.cs +++ b/src/Polyfill/Numbers/IntPolyfill.cs @@ -4,6 +4,7 @@ // ReSharper disable RedundantUsingDirective // ReSharper disable PartialTypeWithSinglePart +namespace Polyfills; using System; using System.Collections.Generic; using System.Diagnostics; diff --git a/src/Polyfill/Numbers/LongPolyfill.cs b/src/Polyfill/Numbers/LongPolyfill.cs index 0884cdcc..d3a28cb7 100644 --- a/src/Polyfill/Numbers/LongPolyfill.cs +++ b/src/Polyfill/Numbers/LongPolyfill.cs @@ -4,6 +4,7 @@ // ReSharper disable RedundantUsingDirective // ReSharper disable PartialTypeWithSinglePart +namespace Polyfills; using System; using System.Collections.Generic; using System.Diagnostics; diff --git a/src/Polyfill/Numbers/SBytePolyfill.cs b/src/Polyfill/Numbers/SBytePolyfill.cs index 9ba78155..e39a8789 100644 --- a/src/Polyfill/Numbers/SBytePolyfill.cs +++ b/src/Polyfill/Numbers/SBytePolyfill.cs @@ -4,6 +4,7 @@ // ReSharper disable RedundantUsingDirective // ReSharper disable PartialTypeWithSinglePart +namespace Polyfills; using System; using System.Collections.Generic; using System.Diagnostics; diff --git a/src/Polyfill/Numbers/ShortPolyfill.cs b/src/Polyfill/Numbers/ShortPolyfill.cs index 1613f055..675f475d 100644 --- a/src/Polyfill/Numbers/ShortPolyfill.cs +++ b/src/Polyfill/Numbers/ShortPolyfill.cs @@ -4,6 +4,7 @@ // ReSharper disable RedundantUsingDirective // ReSharper disable PartialTypeWithSinglePart +namespace Polyfills; using System; using System.Collections.Generic; using System.Diagnostics; diff --git a/src/Polyfill/Numbers/UIntPolyfill.cs b/src/Polyfill/Numbers/UIntPolyfill.cs index 9e0c7110..91abdf11 100644 --- a/src/Polyfill/Numbers/UIntPolyfill.cs +++ b/src/Polyfill/Numbers/UIntPolyfill.cs @@ -4,6 +4,7 @@ // ReSharper disable RedundantUsingDirective // ReSharper disable PartialTypeWithSinglePart +namespace Polyfills; using System; using System.Collections.Generic; using System.Diagnostics; diff --git a/src/Polyfill/Numbers/ULongPolyfill.cs b/src/Polyfill/Numbers/ULongPolyfill.cs index 3ae3f320..ffbf3037 100644 --- a/src/Polyfill/Numbers/ULongPolyfill.cs +++ b/src/Polyfill/Numbers/ULongPolyfill.cs @@ -4,6 +4,7 @@ // ReSharper disable RedundantUsingDirective // ReSharper disable PartialTypeWithSinglePart +namespace Polyfills; using System; using System.Collections.Generic; using System.Diagnostics; diff --git a/src/Polyfill/Numbers/UShortPolyfill.cs b/src/Polyfill/Numbers/UShortPolyfill.cs index 56926a30..bf1b76e9 100644 --- a/src/Polyfill/Numbers/UShortPolyfill.cs +++ b/src/Polyfill/Numbers/UShortPolyfill.cs @@ -4,6 +4,7 @@ // ReSharper disable RedundantUsingDirective // ReSharper disable PartialTypeWithSinglePart +namespace Polyfills; using System; using System.Collections.Generic; using System.Diagnostics; diff --git a/src/Polyfill/Polyfill.cs b/src/Polyfill/Polyfill.cs index 3a800a59..8bea36d4 100644 --- a/src/Polyfill/Polyfill.cs +++ b/src/Polyfill/Polyfill.cs @@ -1,5 +1,8 @@ // #pragma warning disable +global using global::Polyfills; + +namespace Polyfills; using System.ComponentModel; using System.Diagnostics; diff --git a/src/Polyfill/Polyfill_CancellationToken.cs b/src/Polyfill/Polyfill_CancellationToken.cs index c28a1365..93e09605 100644 --- a/src/Polyfill/Polyfill_CancellationToken.cs +++ b/src/Polyfill/Polyfill_CancellationToken.cs @@ -3,6 +3,7 @@ #nullable enable +namespace Polyfills; using System; using System.Threading; using Link = System.ComponentModel.DescriptionAttribute; diff --git a/src/Polyfill/Polyfill_CancellationTokenSource.cs b/src/Polyfill/Polyfill_CancellationTokenSource.cs index f110c87c..77fcc7a5 100644 --- a/src/Polyfill/Polyfill_CancellationTokenSource.cs +++ b/src/Polyfill/Polyfill_CancellationTokenSource.cs @@ -1,6 +1,7 @@ // #pragma warning disable +namespace Polyfills; using System; using System.Reflection; using System.Threading; diff --git a/src/Polyfill/Polyfill_ConcurrentDictionary.cs b/src/Polyfill/Polyfill_ConcurrentDictionary.cs index 4089598e..e9fe42bc 100644 --- a/src/Polyfill/Polyfill_ConcurrentDictionary.cs +++ b/src/Polyfill/Polyfill_ConcurrentDictionary.cs @@ -1,6 +1,7 @@ // #pragma warning disable +namespace Polyfills; using System; using System.Collections.Generic; using System.Collections.Concurrent; diff --git a/src/Polyfill/Polyfill_Dictionary.cs b/src/Polyfill/Polyfill_Dictionary.cs index ac94478f..c7f0e742 100644 --- a/src/Polyfill/Polyfill_Dictionary.cs +++ b/src/Polyfill/Polyfill_Dictionary.cs @@ -1,6 +1,7 @@ // #pragma warning disable +namespace Polyfills; using System; using System.Collections.Generic; using System.Collections.ObjectModel; diff --git a/src/Polyfill/Polyfill_HashSet.cs b/src/Polyfill/Polyfill_HashSet.cs index f8f72f05..73e25a17 100644 --- a/src/Polyfill/Polyfill_HashSet.cs +++ b/src/Polyfill/Polyfill_HashSet.cs @@ -3,6 +3,7 @@ #if NET46X || NET47 || NET471 || NETSTANDARD2_0 +namespace Polyfills; using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; diff --git a/src/Polyfill/Polyfill_HttpClient.cs b/src/Polyfill/Polyfill_HttpClient.cs index 47b0b3a0..12f111b4 100644 --- a/src/Polyfill/Polyfill_HttpClient.cs +++ b/src/Polyfill/Polyfill_HttpClient.cs @@ -3,6 +3,7 @@ #if ((NETFRAMEWORK && FetureHttp) || NETSTANDARD || NETCOREAPP2X || NETCOREAPP3X) +namespace Polyfills; using System; using System.IO; using System.Net.Http; diff --git a/src/Polyfill/Polyfill_HttpContent.cs b/src/Polyfill/Polyfill_HttpContent.cs index c0aa433c..91a8a2df 100644 --- a/src/Polyfill/Polyfill_HttpContent.cs +++ b/src/Polyfill/Polyfill_HttpContent.cs @@ -3,6 +3,7 @@ #if ((NETFRAMEWORK && FetureHttp) || NETSTANDARD || NETCOREAPP2X || NETCOREAPP3X) +namespace Polyfills; using System.IO; using System.Net.Http; using System.Threading; diff --git a/src/Polyfill/Polyfill_IEnumerable.cs b/src/Polyfill/Polyfill_IEnumerable.cs index 3aab50b4..8b31b44b 100644 --- a/src/Polyfill/Polyfill_IEnumerable.cs +++ b/src/Polyfill/Polyfill_IEnumerable.cs @@ -1,6 +1,7 @@ // #pragma warning disable +namespace Polyfills; using System; using System.Collections; using System.Collections.Generic; diff --git a/src/Polyfill/Polyfill_IEnumerable_AggregateBy.cs b/src/Polyfill/Polyfill_IEnumerable_AggregateBy.cs index 1c865a51..9c5536d7 100644 --- a/src/Polyfill/Polyfill_IEnumerable_AggregateBy.cs +++ b/src/Polyfill/Polyfill_IEnumerable_AggregateBy.cs @@ -1,6 +1,7 @@ // #pragma warning disable +namespace Polyfills; using System; using System.Collections.Generic; using Link = System.ComponentModel.DescriptionAttribute; diff --git a/src/Polyfill/Polyfill_IEnumerable_Chunk.cs b/src/Polyfill/Polyfill_IEnumerable_Chunk.cs index 4ed2522f..45cbca5b 100644 --- a/src/Polyfill/Polyfill_IEnumerable_Chunk.cs +++ b/src/Polyfill/Polyfill_IEnumerable_Chunk.cs @@ -1,6 +1,7 @@ // #pragma warning disable +namespace Polyfills; using System; using System.Collections; using System.Collections.Generic; diff --git a/src/Polyfill/Polyfill_IEnumerable_CountBy.cs b/src/Polyfill/Polyfill_IEnumerable_CountBy.cs index a1545fe9..0b6bcc37 100644 --- a/src/Polyfill/Polyfill_IEnumerable_CountBy.cs +++ b/src/Polyfill/Polyfill_IEnumerable_CountBy.cs @@ -1,6 +1,7 @@ // #pragma warning disable +namespace Polyfills; using System; using System.Collections.Generic; using Link = System.ComponentModel.DescriptionAttribute; diff --git a/src/Polyfill/Polyfill_IEnumerable_DistinctBy.cs b/src/Polyfill/Polyfill_IEnumerable_DistinctBy.cs index b0bef0da..4729de4f 100644 --- a/src/Polyfill/Polyfill_IEnumerable_DistinctBy.cs +++ b/src/Polyfill/Polyfill_IEnumerable_DistinctBy.cs @@ -1,6 +1,7 @@ // #pragma warning disable +namespace Polyfills; using System; using System.Collections; using System.Collections.Generic; diff --git a/src/Polyfill/Polyfill_IEnumerable_ElementAt.cs b/src/Polyfill/Polyfill_IEnumerable_ElementAt.cs index 08a0d46d..25e55a6a 100644 --- a/src/Polyfill/Polyfill_IEnumerable_ElementAt.cs +++ b/src/Polyfill/Polyfill_IEnumerable_ElementAt.cs @@ -1,6 +1,7 @@ // #pragma warning disable +namespace Polyfills; using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; diff --git a/src/Polyfill/Polyfill_IEnumerable_Except.cs b/src/Polyfill/Polyfill_IEnumerable_Except.cs index c4330087..9c775422 100644 --- a/src/Polyfill/Polyfill_IEnumerable_Except.cs +++ b/src/Polyfill/Polyfill_IEnumerable_Except.cs @@ -1,6 +1,7 @@ // #pragma warning disable +namespace Polyfills; using System; using System.Collections; using System.Collections.Generic; diff --git a/src/Polyfill/Polyfill_IEnumerable_FirstOrDefault.cs b/src/Polyfill/Polyfill_IEnumerable_FirstOrDefault.cs index 805d1d74..0ed5b447 100644 --- a/src/Polyfill/Polyfill_IEnumerable_FirstOrDefault.cs +++ b/src/Polyfill/Polyfill_IEnumerable_FirstOrDefault.cs @@ -1,6 +1,7 @@ // #pragma warning disable +namespace Polyfills; using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; diff --git a/src/Polyfill/Polyfill_IEnumerable_LastOrDefault.cs b/src/Polyfill/Polyfill_IEnumerable_LastOrDefault.cs index d4e5d375..c4c1b55b 100644 --- a/src/Polyfill/Polyfill_IEnumerable_LastOrDefault.cs +++ b/src/Polyfill/Polyfill_IEnumerable_LastOrDefault.cs @@ -1,6 +1,7 @@ // #pragma warning disable +namespace Polyfills; using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; diff --git a/src/Polyfill/Polyfill_IEnumerable_MaxBy.cs b/src/Polyfill/Polyfill_IEnumerable_MaxBy.cs index 7a83d934..18530fc8 100644 --- a/src/Polyfill/Polyfill_IEnumerable_MaxBy.cs +++ b/src/Polyfill/Polyfill_IEnumerable_MaxBy.cs @@ -1,6 +1,7 @@ // #pragma warning disable +namespace Polyfills; using System; using System.Collections; using System.Collections.Generic; diff --git a/src/Polyfill/Polyfill_IEnumerable_MinBy.cs b/src/Polyfill/Polyfill_IEnumerable_MinBy.cs index cd1085dd..721f54db 100644 --- a/src/Polyfill/Polyfill_IEnumerable_MinBy.cs +++ b/src/Polyfill/Polyfill_IEnumerable_MinBy.cs @@ -1,6 +1,7 @@ // #pragma warning disable +namespace Polyfills; using System; using System.Collections; using System.Collections.Generic; diff --git a/src/Polyfill/Polyfill_IEnumerable_SingleOrDefault.cs b/src/Polyfill/Polyfill_IEnumerable_SingleOrDefault.cs index c593f685..79f14efd 100644 --- a/src/Polyfill/Polyfill_IEnumerable_SingleOrDefault.cs +++ b/src/Polyfill/Polyfill_IEnumerable_SingleOrDefault.cs @@ -1,6 +1,7 @@ // #pragma warning disable +namespace Polyfills; using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; diff --git a/src/Polyfill/Polyfill_IEnumerable_Zip.cs b/src/Polyfill/Polyfill_IEnumerable_Zip.cs index 4842fa77..105863b6 100644 --- a/src/Polyfill/Polyfill_IEnumerable_Zip.cs +++ b/src/Polyfill/Polyfill_IEnumerable_Zip.cs @@ -1,6 +1,7 @@ // #pragma warning disable +namespace Polyfills; using System; using System.Collections; using System.Collections.Generic; diff --git a/src/Polyfill/Polyfill_IReadOnlyDictionary.cs b/src/Polyfill/Polyfill_IReadOnlyDictionary.cs index 17b63a07..2afff795 100644 --- a/src/Polyfill/Polyfill_IReadOnlyDictionary.cs +++ b/src/Polyfill/Polyfill_IReadOnlyDictionary.cs @@ -3,6 +3,7 @@ #if NETFRAMEWORK || NETSTANDARD2_0 +namespace Polyfills; using System; using System.Collections.Generic; using Link = System.ComponentModel.DescriptionAttribute; diff --git a/src/Polyfill/Polyfill_KeyValuePair.cs b/src/Polyfill/Polyfill_KeyValuePair.cs index 63bd91d4..808d54c5 100644 --- a/src/Polyfill/Polyfill_KeyValuePair.cs +++ b/src/Polyfill/Polyfill_KeyValuePair.cs @@ -3,6 +3,7 @@ #if NETFRAMEWORK || NETSTANDARD2_0 +namespace Polyfills; using System; using System.Collections.Generic; using Link = System.ComponentModel.DescriptionAttribute; diff --git a/src/Polyfill/Polyfill_List.cs b/src/Polyfill/Polyfill_List.cs index 34a987f4..907781fa 100644 --- a/src/Polyfill/Polyfill_List.cs +++ b/src/Polyfill/Polyfill_List.cs @@ -1,7 +1,7 @@ // #pragma warning disable - +namespace Polyfills; using System; using System.Collections.Generic; using System.Collections.ObjectModel; diff --git a/src/Polyfill/Polyfill_Memory.cs b/src/Polyfill/Polyfill_Memory.cs index 6a6c2269..805b49cf 100644 --- a/src/Polyfill/Polyfill_Memory.cs +++ b/src/Polyfill/Polyfill_Memory.cs @@ -3,6 +3,7 @@ #if FeatureMemory +namespace Polyfills; using System; using System.Collections.Generic; using System.Text; diff --git a/src/Polyfill/Polyfill_MicroNanosecond.cs b/src/Polyfill/Polyfill_MicroNanosecond.cs index d4cb7e83..d4092544 100644 --- a/src/Polyfill/Polyfill_MicroNanosecond.cs +++ b/src/Polyfill/Polyfill_MicroNanosecond.cs @@ -1,6 +1,7 @@ // #pragma warning disable +namespace Polyfills; using System; using Link = System.ComponentModel.DescriptionAttribute; diff --git a/src/Polyfill/Polyfill_MicroNanosecondAdd.cs b/src/Polyfill/Polyfill_MicroNanosecondAdd.cs index 6095d986..667c7f07 100644 --- a/src/Polyfill/Polyfill_MicroNanosecondAdd.cs +++ b/src/Polyfill/Polyfill_MicroNanosecondAdd.cs @@ -1,6 +1,7 @@ // #pragma warning disable +namespace Polyfills; using System; using Link = System.ComponentModel.DescriptionAttribute; diff --git a/src/Polyfill/Polyfill_Process.cs b/src/Polyfill/Polyfill_Process.cs index e22a7a55..9c8325d4 100644 --- a/src/Polyfill/Polyfill_Process.cs +++ b/src/Polyfill/Polyfill_Process.cs @@ -3,6 +3,7 @@ #if !NET5_0_OR_GREATER +namespace Polyfills; using System; using System.Diagnostics; using System.Threading; diff --git a/src/Polyfill/Polyfill_Random.cs b/src/Polyfill/Polyfill_Random.cs index 0ffffe57..63f693cf 100644 --- a/src/Polyfill/Polyfill_Random.cs +++ b/src/Polyfill/Polyfill_Random.cs @@ -1,6 +1,7 @@ // #pragma warning disable +namespace Polyfills; using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; diff --git a/src/Polyfill/Polyfill_SortedList.cs b/src/Polyfill/Polyfill_SortedList.cs index 0164c234..7f84f20a 100644 --- a/src/Polyfill/Polyfill_SortedList.cs +++ b/src/Polyfill/Polyfill_SortedList.cs @@ -3,6 +3,7 @@ #if !NET7_0_OR_GREATER +namespace Polyfills; using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; diff --git a/src/Polyfill/Polyfill_Stream.cs b/src/Polyfill/Polyfill_Stream.cs index 6f628bf2..49338a75 100644 --- a/src/Polyfill/Polyfill_Stream.cs +++ b/src/Polyfill/Polyfill_Stream.cs @@ -3,6 +3,7 @@ #if FeatureValueTask && (NETFRAMEWORK || NETSTANDARD2_0 || NETCOREAPP2_0) +namespace Polyfills; using System; using System.IO; using System.Runtime.InteropServices; diff --git a/src/Polyfill/Polyfill_String.cs b/src/Polyfill/Polyfill_String.cs index 03a22818..0bbdb20e 100644 --- a/src/Polyfill/Polyfill_String.cs +++ b/src/Polyfill/Polyfill_String.cs @@ -1,6 +1,7 @@ // #pragma warning disable +namespace Polyfills; using System; using Link = System.ComponentModel.DescriptionAttribute; using System.Text; diff --git a/src/Polyfill/Polyfill_StringBuilder.cs b/src/Polyfill/Polyfill_StringBuilder.cs index 47db2347..98ef68ff 100644 --- a/src/Polyfill/Polyfill_StringBuilder.cs +++ b/src/Polyfill/Polyfill_StringBuilder.cs @@ -1,6 +1,7 @@ // #pragma warning disable +namespace Polyfills; using System; using System.ComponentModel; using System.IO; diff --git a/src/Polyfill/Polyfill_Task.cs b/src/Polyfill/Polyfill_Task.cs index 3d9feee9..40c615d4 100644 --- a/src/Polyfill/Polyfill_Task.cs +++ b/src/Polyfill/Polyfill_Task.cs @@ -3,6 +3,7 @@ #if NETFRAMEWORK || NETSTANDARD || NETCOREAPPX || NET5_0 +namespace Polyfills; using System; using System.Reflection; using System.Threading; diff --git a/src/Polyfill/Polyfill_TaskCompletionSource.cs b/src/Polyfill/Polyfill_TaskCompletionSource.cs index 61e8be01..7cc41285 100644 --- a/src/Polyfill/Polyfill_TaskCompletionSource.cs +++ b/src/Polyfill/Polyfill_TaskCompletionSource.cs @@ -3,6 +3,7 @@ #if !NET5_0_OR_GREATER +namespace Polyfills; using System; using System.Threading; using System.Threading.Tasks; diff --git a/src/Polyfill/Polyfill_TextReader.cs b/src/Polyfill/Polyfill_TextReader.cs index 198d1801..ac35bc77 100644 --- a/src/Polyfill/Polyfill_TextReader.cs +++ b/src/Polyfill/Polyfill_TextReader.cs @@ -1,6 +1,7 @@ // #pragma warning disable +namespace Polyfills; using System; using System.IO; using System.Runtime.InteropServices; diff --git a/src/Polyfill/Polyfill_TextWriter.cs b/src/Polyfill/Polyfill_TextWriter.cs index fce1f679..7b9c0de2 100644 --- a/src/Polyfill/Polyfill_TextWriter.cs +++ b/src/Polyfill/Polyfill_TextWriter.cs @@ -3,6 +3,7 @@ #if FeatureMemory && (NETFRAMEWORK || NETSTANDARD2_0 || NETCOREAPP2_0) +namespace Polyfills; using System; using System.Buffers; using System.IO; diff --git a/src/Polyfill/Polyfill_TryFormat.cs b/src/Polyfill/Polyfill_TryFormat.cs index a2a83e53..1b2f4849 100644 --- a/src/Polyfill/Polyfill_TryFormat.cs +++ b/src/Polyfill/Polyfill_TryFormat.cs @@ -1,6 +1,7 @@ // #pragma warning disable +namespace Polyfills; using System; using System.Collections.Generic; using System.Text; diff --git a/src/Polyfill/Polyfill_Type.cs b/src/Polyfill/Polyfill_Type.cs index 276264ba..20eedfcb 100644 --- a/src/Polyfill/Polyfill_Type.cs +++ b/src/Polyfill/Polyfill_Type.cs @@ -1,6 +1,7 @@ // #pragma warning disable +namespace Polyfills; using System; using System.Diagnostics.CodeAnalysis; using System.Reflection; diff --git a/src/Polyfill/Polyfill_XDocument.cs b/src/Polyfill/Polyfill_XDocument.cs index c5c75d23..d9b2fbd6 100644 --- a/src/Polyfill/Polyfill_XDocument.cs +++ b/src/Polyfill/Polyfill_XDocument.cs @@ -3,6 +3,7 @@ #if NETFRAMEWORK || NETSTANDARD2_0 +namespace Polyfills; using System; using System.Diagnostics.CodeAnalysis; using System.Xml; diff --git a/src/Polyfill/Regex/Polyfill_Regex.cs b/src/Polyfill/Regex/Polyfill_Regex.cs index fe588741..0719d57b 100644 --- a/src/Polyfill/Regex/Polyfill_Regex.cs +++ b/src/Polyfill/Regex/Polyfill_Regex.cs @@ -3,7 +3,7 @@ #pragma warning disable #if !NET7_0_OR_GREATER && FeatureMemory - +namespace Polyfills; using System; using System.Text.RegularExpressions; using Link = System.ComponentModel.DescriptionAttribute; diff --git a/src/Polyfill/Regex/RegexPolyfill.cs b/src/Polyfill/Regex/RegexPolyfill.cs index 76a7902e..8bf62314 100644 --- a/src/Polyfill/Regex/RegexPolyfill.cs +++ b/src/Polyfill/Regex/RegexPolyfill.cs @@ -1,6 +1,7 @@ // #pragma warning disable +namespace Polyfills; using System; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; diff --git a/src/Polyfill/StringPolyfill.cs b/src/Polyfill/StringPolyfill.cs index d1a7b889..60e1a128 100644 --- a/src/Polyfill/StringPolyfill.cs +++ b/src/Polyfill/StringPolyfill.cs @@ -4,6 +4,7 @@ // ReSharper disable RedundantUsingDirective // ReSharper disable PartialTypeWithSinglePart +namespace Polyfills; using System; using System.Collections.Generic; using System.Diagnostics; diff --git a/src/TargetFrameworkUsage/FakePolyfillsNamespace.cs b/src/TargetFrameworkUsage/FakePolyfillsNamespace.cs new file mode 100644 index 00000000..be3c3c5a --- /dev/null +++ b/src/TargetFrameworkUsage/FakePolyfillsNamespace.cs @@ -0,0 +1,3 @@ +namespace Polyfills; + +class FakePolyfillsNamespace; diff --git a/src/Tests/GuardTests.cs b/src/Tests/GuardTests.cs index b229b1d6..853fd7ae 100644 --- a/src/Tests/GuardTests.cs +++ b/src/Tests/GuardTests.cs @@ -1,6 +1,4 @@ -using Polyfills; - -[TestFixture] +[TestFixture] public class GuardTests { string nullString = null!;