From 70bbacde1347dbc637c9cdb3806260f90de1cb8c Mon Sep 17 00:00:00 2001 From: xljiulang <366193849@qq.com> Date: Sat, 14 Aug 2021 21:43:57 +0800 Subject: [PATCH] class->record --- FastGithub.Configuration/DnsConfig.cs | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/FastGithub.Configuration/DnsConfig.cs b/FastGithub.Configuration/DnsConfig.cs index 21dd80e..a35ed0f 100644 --- a/FastGithub.Configuration/DnsConfig.cs +++ b/FastGithub.Configuration/DnsConfig.cs @@ -6,18 +6,18 @@ namespace FastGithub.Configuration /// /// dns配置 /// - public class DnsConfig + public record DnsConfig { /// /// IP地址 /// [AllowNull] - public string IPAddress { get; set; } + public string IPAddress { get; init; } /// /// 端口 /// - public int Port { get; set; } = 53; + public int Port { get; init; } = 53; /// /// 转换为IPEndPoint @@ -38,10 +38,5 @@ namespace FastGithub.Configuration return new IPEndPoint(address, this.Port); } - - public override string ToString() - { - return $"{this.IPAddress}:{this.Port}"; - } } }