diff --git a/src/Shared/runtime/Quic/Interop/MsQuicStatusCodes.cs b/src/Shared/runtime/Quic/Interop/MsQuicStatusCodes.cs index face87e41f..af7fd30300 100644 --- a/src/Shared/runtime/Quic/Interop/MsQuicStatusCodes.cs +++ b/src/Shared/runtime/Quic/Interop/MsQuicStatusCodes.cs @@ -1,22 +1,16 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System.Runtime.InteropServices; - namespace System.Net.Quic.Implementations.MsQuic.Internal { internal static class MsQuicStatusCodes { - internal static readonly uint Success = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? Windows.Success : Linux.Success; - internal static readonly uint Pending = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? Windows.Pending : Linux.Pending; - internal static readonly uint InternalError = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? Windows.InternalError : Linux.InternalError; + internal static uint Success => OperatingSystem.IsWindows() ? Windows.Success : Linux.Success; + internal static uint Pending => OperatingSystem.IsWindows() ? Windows.Pending : Linux.Pending; + internal static uint InternalError => OperatingSystem.IsWindows() ? Windows.InternalError : Linux.InternalError; // TODO return better error messages here. - public static string GetError(uint status) - { - return RuntimeInformation.IsOSPlatform(OSPlatform.Windows) - ? Windows.GetError(status) : Linux.GetError(status); - } + public static string GetError(uint status) => OperatingSystem.IsWindows() ? Windows.GetError(status) : Linux.GetError(status); private static class Windows { diff --git a/src/Shared/runtime/Quic/Interop/MsQuicStatusHelper.cs b/src/Shared/runtime/Quic/Interop/MsQuicStatusHelper.cs index 726a548c59..2f64fa2415 100644 --- a/src/Shared/runtime/Quic/Interop/MsQuicStatusHelper.cs +++ b/src/Shared/runtime/Quic/Interop/MsQuicStatusHelper.cs @@ -1,20 +1,18 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System.Runtime.InteropServices; - namespace System.Net.Quic.Implementations.MsQuic.Internal { internal static class MsQuicStatusHelper { internal static bool SuccessfulStatusCode(uint status) { - if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) + if (OperatingSystem.IsWindows()) { return status < 0x80000000; } - if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) + if (OperatingSystem.IsLinux()) { return (int)status <= 0; }