diff --git a/src/Tingle.Extensions.Primitives/ConnectionStringBuilder.cs b/src/Tingle.Extensions.Primitives/ConnectionStringBuilder.cs index 3b7824a..1445793 100644 --- a/src/Tingle.Extensions.Primitives/ConnectionStringBuilder.cs +++ b/src/Tingle.Extensions.Primitives/ConnectionStringBuilder.cs @@ -126,7 +126,7 @@ public ConnectionStringBuilder(char segmentsSeparator = DefaultSegmentsSeparator /// the type of item to be returned /// the key identifying the segment /// - public T? GetValue(string key) + public readonly T? GetValue(string key) { if (TryGetValue(key, out var value) && !string.IsNullOrWhiteSpace(value)) { @@ -244,7 +244,7 @@ private static KeyValuePair ExtractSegment(string segment, char private const string SegmentNameHostname = "Hostname"; /// Gets the value for Key used in authentication. - public string? GetKey() => GetValue(SegmentNameKey); + public readonly string? GetKey() => GetValue(SegmentNameKey); /// Sets value for Key used in authentication. /// @@ -255,17 +255,17 @@ public ConnectionStringBuilder WithKey(string key) } /// Gets the value for Scheme used in making requests. - public string? GetScheme() => GetValue(SegmentNameScheme); + public readonly string? GetScheme() => GetValue(SegmentNameScheme); /// Gets value indicating if the Scheme for making requests is set to . /// - public bool IsScheme(string scheme) => string.Equals(scheme, GetScheme()); + public readonly bool IsScheme(string scheme) => string.Equals(scheme, GetScheme()); /// Gets value indicating if the Scheme for making requests is set to https. - public bool IsHttpsScheme() => IsScheme(Uri.UriSchemeHttps); + public readonly bool IsHttpsScheme() => IsScheme(Uri.UriSchemeHttps); /// Gets value indicating if the Scheme for making requests is set to http. - public bool IsHttpScheme() => IsScheme(Uri.UriSchemeHttp); + public readonly bool IsHttpScheme() => IsScheme(Uri.UriSchemeHttp); /// Sets value for Scheme used in making requests. /// @@ -284,7 +284,7 @@ public ConnectionStringBuilder WithHttpScheme() => WithScheme(Uri.UriSchemeHttp); /// Gets the value for Hostname (usually the FQDN with the port, if needed) used in making the requests. - public string? GetHostname() => GetValue(SegmentNameHostname); + public readonly string? GetHostname() => GetValue(SegmentNameHostname); /// Sets the value for Hostname (usually the FQDN with the port, if needed) used in making the requests. /// @@ -340,10 +340,10 @@ public override readonly string ToString() } /// - public override bool Equals(object? obj) => obj is ConnectionStringBuilder builder && Equals(builder); + public override readonly bool Equals(object? obj) => obj is ConnectionStringBuilder builder && Equals(builder); /// - public bool Equals(ConnectionStringBuilder other) => string.Equals(ToString(), other.ToString()); + public readonly bool Equals(ConnectionStringBuilder other) => string.Equals(ToString(), other.ToString()); /// public override readonly int GetHashCode() => HashCode.Combine(segments, segmentsSeparator, valueSeparator); @@ -400,7 +400,7 @@ public static implicit operator ConnectionStringBuilder(string connectionString) readonly long IConvertible.ToInt64(IFormatProvider? provider) => throw new InvalidCastException(); readonly sbyte IConvertible.ToSByte(IFormatProvider? provider) => throw new InvalidCastException(); readonly float IConvertible.ToSingle(IFormatProvider? provider) => throw new InvalidCastException(); - string IConvertible.ToString(IFormatProvider? provider) => ToString(); + readonly string IConvertible.ToString(IFormatProvider? provider) => ToString(); readonly object IConvertible.ToType(Type conversionType, IFormatProvider? provider) {