From 724853abb0b80031c55469d2f44cb1fe61656e61 Mon Sep 17 00:00:00 2001 From: sta Date: Sat, 29 Apr 2017 14:34:32 +0900 Subject: [PATCH] [Modify] Add them For no roles. --- websocket-sharp/Net/NetworkCredential.cs | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/websocket-sharp/Net/NetworkCredential.cs b/websocket-sharp/Net/NetworkCredential.cs index 7e539da6..17469295 100644 --- a/websocket-sharp/Net/NetworkCredential.cs +++ b/websocket-sharp/Net/NetworkCredential.cs @@ -37,10 +37,20 @@ namespace WebSocketSharp.Net { #region Private Fields - private string _domain; - private string _password; - private string[] _roles; - private string _username; + private string _domain; + private static readonly string[] _noRoles; + private string _password; + private string[] _roles; + private string _username; + + #endregion + + #region Static Constructor + + static NetworkCredential () + { + _noRoles = new string[0]; + } #endregion @@ -158,7 +168,7 @@ namespace WebSocketSharp.Net /// public string[] Roles { get { - return _roles ?? (_roles = new string[0]); + return _roles ?? _noRoles; } internal set {