Skip to content

Commit 10fd259

Browse files
committed
Refactored a few for CloseEventArgs.cs
1 parent 8f91f46 commit 10fd259

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

websocket-sharp/CloseEventArgs.cs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,17 +60,14 @@ public class CloseEventArgs : EventArgs
6060

6161
internal CloseEventArgs ()
6262
{
63+
_code = (ushort) CloseStatusCode.NoStatus;
6364
_payloadData = new PayloadData ();
6465
_rawData = _payloadData.ApplicationData;
65-
66-
_code = (ushort) CloseStatusCode.NoStatus;
67-
_reason = String.Empty;
6866
}
6967

7068
internal CloseEventArgs (ushort code)
7169
{
7270
_code = code;
73-
_reason = String.Empty;
7471
_rawData = code.InternalToByteArray (ByteOrder.Big);
7572
}
7673

@@ -97,7 +94,7 @@ internal CloseEventArgs (PayloadData payloadData)
9794
internal CloseEventArgs (ushort code, string reason)
9895
{
9996
_code = code;
100-
_reason = reason ?? String.Empty;
97+
_reason = reason;
10198
_rawData = code.Append (reason);
10299
}
103100

@@ -146,7 +143,7 @@ public ushort Code {
146143
/// </value>
147144
public string Reason {
148145
get {
149-
return _reason;
146+
return _reason ?? String.Empty;
150147
}
151148
}
152149

0 commit comments

Comments
 (0)