From d7711936b846040111b08b18f546e453a1f8e497 Mon Sep 17 00:00:00 2001 From: Ed Ball Date: Thu, 14 Nov 2024 15:46:08 -0800 Subject: [PATCH] Use NETSTANDARD2_0 as needed. --- src/Facility.Definition/CodeGen/CodeGenUtility.cs | 4 ++-- src/Facility.Definition/Fsd/FsdParsers.cs | 2 +- src/Facility.Definition/Regexes.cs | 2 +- src/Facility.Definition/ServiceDefinitionUtility.cs | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Facility.Definition/CodeGen/CodeGenUtility.cs b/src/Facility.Definition/CodeGen/CodeGenUtility.cs index 4906111..df0d33e 100644 --- a/src/Facility.Definition/CodeGen/CodeGenUtility.cs +++ b/src/Facility.Definition/CodeGen/CodeGenUtility.cs @@ -15,7 +15,7 @@ public static class CodeGenUtility /// /// Capitalizes the specified string. /// -#if NET6_0_OR_GREATER +#if !NETSTANDARD2_0 public static string Capitalize(string value) => value.Length == 0 ? value : string.Concat(value[..1].ToUpperInvariant(), value.AsSpan(1)); #else public static string Capitalize(string value) => value.Length == 0 ? value : value.Substring(0, 1).ToUpperInvariant() + value.Substring(1); @@ -24,7 +24,7 @@ public static class CodeGenUtility /// /// Uncapitalizes the specified string. /// -#if NET6_0_OR_GREATER +#if !NETSTANDARD2_0 public static string Uncapitalize(string value) => value.Length == 0 ? value : string.Concat(value[..1].ToLowerInvariant(), value.AsSpan(1)); #else public static string Uncapitalize(string value) => value.Length == 0 ? value : value.Substring(0, 1).ToLowerInvariant() + value.Substring(1); diff --git a/src/Facility.Definition/Fsd/FsdParsers.cs b/src/Facility.Definition/Fsd/FsdParsers.cs index 15bb857..7609213 100644 --- a/src/Facility.Definition/Fsd/FsdParsers.cs +++ b/src/Facility.Definition/Fsd/FsdParsers.cs @@ -223,7 +223,7 @@ private static string DecodeBackslash(string text) => 'n' => "\n", 'r' => "\r", 't' => "\t", -#if NET6_0_OR_GREATER +#if !NETSTANDARD2_0 'u' => new string((char) ushort.Parse(text.AsSpan(2), NumberStyles.HexNumber, CultureInfo.InvariantCulture), 1), #else 'u' => new string((char) ushort.Parse(text.Substring(2), NumberStyles.HexNumber, CultureInfo.InvariantCulture), 1), diff --git a/src/Facility.Definition/Regexes.cs b/src/Facility.Definition/Regexes.cs index 3745bdd..f95bcf2 100644 --- a/src/Facility.Definition/Regexes.cs +++ b/src/Facility.Definition/Regexes.cs @@ -8,7 +8,7 @@ internal static partial class Regexes { private const string c_wordPattern = "[A-Z]([A-Z]*(?![a-z])|[a-z]*)|[a-z]+|[0-9]+"; private const RegexOptions c_wordOptions = RegexOptions.CultureInvariant | RegexOptions.ExplicitCapture; -#if NET7_0_OR_GREATER +#if !NETSTANDARD2_0 [GeneratedRegex(c_wordPattern, c_wordOptions)] public static partial Regex Word(); #else diff --git a/src/Facility.Definition/ServiceDefinitionUtility.cs b/src/Facility.Definition/ServiceDefinitionUtility.cs index 4b536e7..044b9c1 100644 --- a/src/Facility.Definition/ServiceDefinitionUtility.cs +++ b/src/Facility.Definition/ServiceDefinitionUtility.cs @@ -49,7 +49,7 @@ internal static ServiceDefinitionError CreateInvalidAttributeValueError(string a internal static IReadOnlyList ToReadOnlyList(this IEnumerable? items) => new ReadOnlyCollection((items ?? []).ToList()); -#if NET6_0_OR_GREATER +#if !NETSTANDARD2_0 internal static bool ContainsOrdinal(this string text, string value) => text.Contains(value, StringComparison.Ordinal); internal static string ReplaceOrdinal(this string text, string oldValue, string newValue) => text.Replace(oldValue, newValue, StringComparison.Ordinal); #else