More pattern matching.

This commit is contained in:
2022-11-14 01:49:09 +00:00
parent e6db6032f3
commit a02220902c
8 changed files with 11 additions and 22 deletions

View File

@@ -47,8 +47,7 @@ public static class LisaTag
/// <returns>Decoded tag in Sony's format</returns>
public static SonyTag? DecodeSonyTag(byte[] tag)
{
if(tag == null ||
tag.Length != 12)
if(tag is not { Length: 12 })
return null;
var snTag = new SonyTag
@@ -74,8 +73,7 @@ public static class LisaTag
/// <returns>Decoded tag in Profile's format</returns>
public static ProfileTag? DecodeProfileTag(byte[] tag)
{
if(tag == null ||
tag.Length != 20)
if(tag is not { Length: 20 })
return null;
var phTag = new ProfileTag();
@@ -122,8 +120,7 @@ public static class LisaTag
/// <returns>Decoded tag in Priam's format</returns>
public static PriamTag? DecodePriamTag(byte[] tag)
{
if(tag == null ||
tag.Length != 24)
if(tag is not { Length: 24 })
return null;
var pmTag = new PriamTag();