From 69c72073e1ce132aaf3efffdb69e71f8e0e8592f Mon Sep 17 00:00:00 2001 From: Shreyas Zare Date: Sun, 4 Feb 2024 17:19:13 +0530 Subject: [PATCH] DhcpOption: code refactoring done. --- DnsServerCore/Dhcp/DhcpOption.cs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/DnsServerCore/Dhcp/DhcpOption.cs b/DnsServerCore/Dhcp/DhcpOption.cs index 37c5c017..95efd23a 100644 --- a/DnsServerCore/Dhcp/DhcpOption.cs +++ b/DnsServerCore/Dhcp/DhcpOption.cs @@ -1,6 +1,6 @@ /* Technitium DNS Server -Copyright (C) 2023 Shreyas Zare (shreyas@technitium.com) +Copyright (C) 2024 Shreyas Zare (shreyas@technitium.com) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -123,8 +123,7 @@ namespace DnsServerCore.Dhcp public DhcpOption(DhcpOptionCode code, string hexValue) { - if (hexValue is null) - throw new ArgumentNullException(nameof(hexValue)); + ArgumentNullException.ThrowIfNull(hexValue); _code = code; @@ -136,8 +135,7 @@ namespace DnsServerCore.Dhcp public DhcpOption(DhcpOptionCode code, byte[] value) { - if (value is null) - throw new ArgumentNullException(nameof(value)); + ArgumentNullException.ThrowIfNull(value); _code = code; _value = value; @@ -151,7 +149,7 @@ namespace DnsServerCore.Dhcp if (len < 0) throw new EndOfStreamException(); - _value = s.ReadBytes(len); + _value = s.ReadExactly(len); } protected DhcpOption(DhcpOptionCode code)