Inline out variable declaration

This commit is contained in:
Stepan Goremykin
2023-04-06 19:21:29 +02:00
parent 6ae1903453
commit c051736c80
7 changed files with 10 additions and 21 deletions

View File

@@ -244,7 +244,6 @@ namespace Rssdp.Infrastructure
// Wait on random interval up to MX, as per SSDP spec.
// Also, as per UPnP 1.1/SSDP spec ignore missing/bank MX header. If over 120, assume random value between 0 and 120.
// Using 16 as minimum as that's often the minimum system clock frequency anyway.
int maxWaitInterval = 0;
if (String.IsNullOrEmpty(mx))
{
// Windows Explorer is poorly behaved and doesn't supply an MX header value.
@@ -254,7 +253,7 @@ namespace Rssdp.Infrastructure
// return;
}
if (!Int32.TryParse(mx, out maxWaitInterval) || maxWaitInterval <= 0)
if (!Int32.TryParse(mx, out var maxWaitInterval) || maxWaitInterval <= 0)
{
return;
}
@@ -581,8 +580,7 @@ namespace Rssdp.Infrastructure
private string GetFirstHeaderValue(System.Net.Http.Headers.HttpRequestHeaders httpRequestHeaders, string headerName)
{
string retVal = null;
IEnumerable<String> values = null;
if (httpRequestHeaders.TryGetValues(headerName, out values) && values != null)
if (httpRequestHeaders.TryGetValues(headerName, out var values) && values != null)
{
retVal = values.FirstOrDefault();
}