Skip to content

Commit e5dd929

Browse files
committed
Replaced private setter with property initializer (#5139)
1 parent 4b0b44c commit e5dd929

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

src/NLog/Targets/WebServiceTarget.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,6 @@ public WebServiceTarget()
9999
Encoding = new UTF8Encoding(writeBOM);
100100
IncludeBOM = writeBOM;
101101

102-
Headers = new List<MethodCallParameter>();
103-
104102
#if NETSTANDARD1_3 || NETSTANDARD1_5
105103
// NetCore1 throws PlatformNotSupportedException on WebRequest.GetSystemWebProxy, when using DefaultWebProxy
106104
// Net5 (or newer) will turn off Http-connection-pooling if not using DefaultWebProxy
@@ -223,7 +221,7 @@ public WebServiceProxyType ProxyType
223221
/// </summary>
224222
/// <docgen category='Web Service Options' order='10' />
225223
[ArrayParameter(typeof(MethodCallParameter), "header")]
226-
public IList<MethodCallParameter> Headers { get; private set; }
224+
public IList<MethodCallParameter> Headers { get; } = new List<MethodCallParameter>();
227225

228226
/// <summary>
229227
/// Indicates whether to pre-authenticate the HttpWebRequest (Requires 'Authorization' in <see cref="Headers"/> parameters)
@@ -574,7 +572,7 @@ protected HttpPostFormatterBase(WebServiceTarget target)
574572
protected string ContentType => _contentType ?? (_contentType = GetContentType(Target));
575573
private string _contentType;
576574

577-
protected WebServiceTarget Target { get; private set; }
575+
protected WebServiceTarget Target { get; }
578576

579577
protected virtual string GetContentType(WebServiceTarget target)
580578
{

0 commit comments

Comments
 (0)