From 0462eaac5ef31084ca7c031858caeae358adcb42 Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Wed, 16 Mar 2022 11:47:00 +0000 Subject: [PATCH] Use merge pattern. --- ArrayIsEmpty.cs | 2 +- DateHandlers.cs | 3 +-- Marshal.cs | 3 +-- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/ArrayIsEmpty.cs b/ArrayIsEmpty.cs index 07d6ec5..7df593c 100644 --- a/ArrayIsEmpty.cs +++ b/ArrayIsEmpty.cs @@ -40,7 +40,7 @@ public static partial class ArrayHelpers /// Checks if an array is null, filled with the NULL byte (0x00) or ASCII whitespace (0x20) /// Array /// True if null or whitespace - public static bool ArrayIsNullOrWhiteSpace(byte[] array) => array?.All(b => b == 0x00 || b == 0x20) != false; + public static bool ArrayIsNullOrWhiteSpace(byte[] array) => array?.All(b => b is 0x00 or 0x20) != false; /// Checks if an array is null or filled with the NULL byte (0x00) /// Array diff --git a/DateHandlers.cs b/DateHandlers.cs index 3c7ee08..9925a16 100644 --- a/DateHandlers.cs +++ b/DateHandlers.cs @@ -302,8 +302,7 @@ public static class DateHandlers if(offset == -2047) return new DateTime(year, month, day, hour, minute, second, DateTimeKind.Unspecified).AddTicks(ticks); - if(offset < -1440 || - offset > 1440) + if(offset is < -1440 or > 1440) offset = 0; return new DateTimeOffset(year, month, day, hour, minute, second, new TimeSpan(0, offset, 0)).AddTicks(ticks). diff --git a/Marshal.cs b/Marshal.cs index bdb31c7..28ba112 100644 --- a/Marshal.cs +++ b/Marshal.cs @@ -439,8 +439,7 @@ public static class Marshal { outBuf = null; - if(hex is null || - hex == "") + if(hex is null or "") return -1; var off = 0;