Inline out variable declarations
This commit is contained in:
Родитель
3a557db263
Коммит
7939a3afb9
|
@ -53,8 +53,7 @@ public class MessageHeaderTests : TestBase
|
|||
}
|
||||
|
||||
Assert.True(headers.ContainsKey("Content-Length"));
|
||||
int length;
|
||||
Assert.True(int.TryParse(headers["Content-Length"], out length));
|
||||
Assert.True(int.TryParse(headers["Content-Length"], out int length));
|
||||
Assert.NotEqual(0, length);
|
||||
byte[] messageBuffer = new byte[length];
|
||||
int bytesRead = 0;
|
||||
|
|
|
@ -167,16 +167,14 @@ namespace StreamJsonRpc
|
|||
}
|
||||
while (state != HeaderParseState.Terminate);
|
||||
|
||||
int contentLength;
|
||||
string contentLengthAsText = headers[ContentLengthHeaderNameText];
|
||||
if (!int.TryParse(contentLengthAsText, out contentLength))
|
||||
if (!int.TryParse(contentLengthAsText, out int contentLength))
|
||||
{
|
||||
throw new BadRpcHeaderException(string.Format(CultureInfo.CurrentCulture, Resources.HeaderContentLengthNotParseable, contentLengthAsText));
|
||||
}
|
||||
|
||||
Encoding contentEncoding = this.Encoding;
|
||||
string contentTypeAsText;
|
||||
if (headers.TryGetValue(ContentTypeHeaderNameText, out contentTypeAsText))
|
||||
if (headers.TryGetValue(ContentTypeHeaderNameText, out string contentTypeAsText))
|
||||
{
|
||||
contentEncoding = ParseEncodingFromContentTypeHeader(contentTypeAsText) ?? contentEncoding;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче