From 8ab38c7dc69bdc1e92430356648bca394a79ece1 Mon Sep 17 00:00:00 2001 From: Shreyas Zare Date: Sat, 14 Sep 2024 16:27:11 +0530 Subject: [PATCH] minor code optimization changes. --- DnsServerSystemTrayApp/frmManageDnsProviders.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/DnsServerSystemTrayApp/frmManageDnsProviders.cs b/DnsServerSystemTrayApp/frmManageDnsProviders.cs index f61eca06..1c3b00c3 100644 --- a/DnsServerSystemTrayApp/frmManageDnsProviders.cs +++ b/DnsServerSystemTrayApp/frmManageDnsProviders.cs @@ -1,6 +1,6 @@ /* Technitium DNS Server -Copyright (C) 2019 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 @@ -29,6 +29,8 @@ namespace DnsServerSystemTrayApp { #region variables + static readonly char[] commaSeparator = new char[] { ',' }; + readonly List _dnsProviders = new List(); #endregion @@ -106,7 +108,7 @@ namespace DnsServerSystemTrayApp List addresses = new List(); - foreach (string item in txtIpv4Addresses.Text.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries)) + foreach (string item in txtIpv4Addresses.Text.Split(commaSeparator, StringSplitOptions.RemoveEmptyEntries)) { if (IPAddress.TryParse(item.Trim(), out IPAddress address) && (address.AddressFamily == AddressFamily.InterNetwork)) { @@ -119,7 +121,7 @@ namespace DnsServerSystemTrayApp } } - foreach (string item in txtIpv6Addresses.Text.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries)) + foreach (string item in txtIpv6Addresses.Text.Split(commaSeparator, StringSplitOptions.RemoveEmptyEntries)) { if (IPAddress.TryParse(item.Trim(), out IPAddress address) && (address.AddressFamily == AddressFamily.InterNetworkV6)) {