mirror of
https://github.com/nsnail/spectre.console.git
synced 2025-06-19 13:28:16 +08:00
Future-proof conditional compilation
* Invert `#if NET5_0` conditions so that when adding net6.0 target framework, the _new_ APIs are used. * Use `NET5_0_OR_GREATER` instead of `NET5_0` to ensure consistent behaviour on future target frameworks.
This commit is contained in:

committed by
Patrik Svensson

parent
644fb76d61
commit
a5716a35e2
@ -177,19 +177,19 @@ namespace Spectre.Console
|
||||
|
||||
internal static string ReplaceExact(this string text, string oldValue, string? newValue)
|
||||
{
|
||||
#if NET5_0
|
||||
return text.Replace(oldValue, newValue, StringComparison.Ordinal);
|
||||
#else
|
||||
#if NETSTANDARD2_0
|
||||
return text.Replace(oldValue, newValue);
|
||||
#else
|
||||
return text.Replace(oldValue, newValue, StringComparison.Ordinal);
|
||||
#endif
|
||||
}
|
||||
|
||||
internal static bool ContainsExact(this string text, string value)
|
||||
{
|
||||
#if NET5_0
|
||||
return text.Contains(value, StringComparison.Ordinal);
|
||||
#else
|
||||
#if NETSTANDARD2_0
|
||||
return text.Contains(value);
|
||||
#else
|
||||
return text.Contains(value, StringComparison.Ordinal);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user