diff --git a/src/libraries/System.Collections/src/System/Collections/Generic/OrderedDictionary.cs b/src/libraries/System.Collections/src/System/Collections/Generic/OrderedDictionary.cs index 8551dcb0ad6ff..2e855a343f97c 100644 --- a/src/libraries/System.Collections/src/System/Collections/Generic/OrderedDictionary.cs +++ b/src/libraries/System.Collections/src/System/Collections/Generic/OrderedDictionary.cs @@ -6,7 +6,7 @@ using System.Runtime.CompilerServices; using System.Runtime.InteropServices; -#if NET8_0_OR_GREATER +#if NET using static System.ArgumentNullException; using static System.ArgumentOutOfRangeException; #else diff --git a/src/libraries/System.Collections/src/System/Collections/ThrowHelper.cs b/src/libraries/System.Collections/src/System/Collections/ThrowHelper.cs index 64a2e552bbb64..a2a64893f3750 100644 --- a/src/libraries/System.Collections/src/System/Collections/ThrowHelper.cs +++ b/src/libraries/System.Collections/src/System/Collections/ThrowHelper.cs @@ -34,7 +34,7 @@ internal static void ThrowIndexArgumentOutOfRange() => internal static void ThrowVersionCheckFailed() => throw new InvalidOperationException(SR.InvalidOperation_EnumFailedVersion); -#if !NET8_0_OR_GREATER +#if !NET /// Throws an if is null. /// The reference type argument to validate as non-null. /// The name of the parameter with which corresponds. diff --git a/src/libraries/System.IO.Compression/src/System/IO/Compression/DeflateZLib/ZLibException.cs b/src/libraries/System.IO.Compression/src/System/IO/Compression/DeflateZLib/ZLibException.cs index c9748918a0a7e..3c29f19bf9a47 100644 --- a/src/libraries/System.IO.Compression/src/System/IO/Compression/DeflateZLib/ZLibException.cs +++ b/src/libraries/System.IO.Compression/src/System/IO/Compression/DeflateZLib/ZLibException.cs @@ -53,10 +53,8 @@ public ZLibException(string? message, Exception? innerException) : base(message, /// /// The SerializationInfo that holds the serialized object data about the exception being thrown. /// The StreamingContext that contains contextual information about the source or destination. -#if NET8_0_OR_GREATER [Obsolete(Obsoletions.LegacyFormatterImplMessage, DiagnosticId = Obsoletions.LegacyFormatterImplDiagId, UrlFormat = Obsoletions.SharedUrlFormat)] [EditorBrowsable(EditorBrowsableState.Never)] -#endif protected ZLibException(SerializationInfo info, StreamingContext context) : base(info, context) { _zlibErrorContext = info.GetString("zlibErrorContext"); @@ -64,9 +62,7 @@ protected ZLibException(SerializationInfo info, StreamingContext context) : base _zlibErrorMessage = info.GetString("zlibErrorMessage"); } -#if NET8_0_OR_GREATER [Obsolete(Obsoletions.LegacyFormatterImplMessage, DiagnosticId = Obsoletions.LegacyFormatterImplDiagId, UrlFormat = Obsoletions.SharedUrlFormat)] -#endif void ISerializable.GetObjectData(SerializationInfo si, StreamingContext context) { base.GetObjectData(si, context); diff --git a/src/libraries/System.Private.CoreLib/src/System/Collections/Generic/ICollectionDebugView.cs b/src/libraries/System.Private.CoreLib/src/System/Collections/Generic/ICollectionDebugView.cs index 424694d4f8e0b..5be0acf724fff 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Collections/Generic/ICollectionDebugView.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Collections/Generic/ICollectionDebugView.cs @@ -11,7 +11,7 @@ internal sealed class ICollectionDebugView public ICollectionDebugView(ICollection collection) { -#if NET8_0_OR_GREATER +#if NET ArgumentNullException.ThrowIfNull(collection); #else if (collection is null) diff --git a/src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexCharClass.cs b/src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexCharClass.cs index d78bc3c0a7f4a..8a4acef3785be 100644 --- a/src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexCharClass.cs +++ b/src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexCharClass.cs @@ -1042,7 +1042,7 @@ public static bool ParticipatesInCaseConversion(ReadOnlySpan s) /// Gets whether the specified span contains only ASCII. public static bool IsAscii(ReadOnlySpan s) { -#if NET8_0_OR_GREATER +#if NET return Ascii.IsValid(s); #else foreach (char c in s) diff --git a/src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexParser.cs b/src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexParser.cs index fc6fa74e114ba..137ac1878ed2e 100644 --- a/src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexParser.cs +++ b/src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexParser.cs @@ -1938,7 +1938,7 @@ internal static int MapCaptureNumber(int capnum, Hashtable? caps) => 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, Q, S, 0, 0, 0 ]; -#if NET8_0_OR_GREATER +#if NET private static readonly SearchValues s_metachars = SearchValues.Create("\t\n\f\r #$()*+.?[\\^{|");