diff options
Diffstat (limited to 'SocketHttpListener/Ext.cs')
| -rw-r--r-- | SocketHttpListener/Ext.cs | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/SocketHttpListener/Ext.cs b/SocketHttpListener/Ext.cs index 125775180..b051b6718 100644 --- a/SocketHttpListener/Ext.cs +++ b/SocketHttpListener/Ext.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Collections.Specialized; using System.IO; using System.IO.Compression; using System.Net; @@ -149,7 +148,7 @@ namespace SocketHttpListener internal static string CheckIfValidControlData(this byte[] data, string paramName) { return data.Length > 125 - ? String.Format("'{0}' length must be less.", paramName) + ? string.Format("'{0}' length must be less.", paramName) : null; } @@ -222,7 +221,7 @@ namespace SocketHttpListener internal static bool EqualsWith(this int value, char c, Action<int> action) { if (value < 0 || value > 255) - throw new ArgumentOutOfRangeException("value"); + throw new ArgumentOutOfRangeException(nameof(value)); action(value); return value == c - 0; @@ -248,7 +247,7 @@ namespace SocketHttpListener ? "WebSocket server got an internal error." : code == CloseStatusCode.TlsHandshakeFailure ? "An error has occurred while handshaking." - : String.Empty; + : string.Empty; } internal static string GetNameInternal(this string nameAndValue, string separator) @@ -329,7 +328,7 @@ namespace SocketHttpListener { return value.IsToken() ? value - : String.Format("\"{0}\"", value.Replace("\"", "\\\"")); + : string.Format("\"{0}\"", value.Replace("\"", "\\\"")); } internal static byte[] ReadBytes(this Stream stream, int length) @@ -441,7 +440,8 @@ namespace SocketHttpListener continue; } } - else { + else + { } buffer.Append(c); @@ -484,13 +484,13 @@ namespace SocketHttpListener this CompressionMethod method, params string[] parameters) { if (method == CompressionMethod.None) - return String.Empty; + return string.Empty; - var m = String.Format("permessage-{0}", method.ToString().ToLower()); + var m = string.Format("permessage-{0}", method.ToString().ToLower()); if (parameters == null || parameters.Length == 0) return m; - return String.Format("{0}; {1}", m, parameters.ToString("; ")); + return string.Format("{0}; {1}", m, parameters.ToString("; ")); } internal static List<TSource> ToList<TSource>(this IEnumerable<TSource> source) @@ -715,7 +715,7 @@ namespace SocketHttpListener case 507: return "Insufficient Storage"; } - return String.Empty; + return string.Empty; } /// <summary> @@ -855,7 +855,7 @@ namespace SocketHttpListener public static byte[] ToHostOrder(this byte[] src, ByteOrder srcOrder) { if (src == null) - throw new ArgumentNullException("src"); + throw new ArgumentNullException(nameof(src)); return src.Length > 1 && !srcOrder.IsHostOrder() ? src.Reverse() @@ -886,14 +886,14 @@ namespace SocketHttpListener public static string ToString<T>(this T[] array, string separator) { if (array == null) - throw new ArgumentNullException("array"); + throw new ArgumentNullException(nameof(array)); var len = array.Length; if (len == 0) - return String.Empty; + return string.Empty; if (separator == null) - separator = String.Empty; + separator = string.Empty; var buff = new StringBuilder(64); (len - 1).Times(i => buff.AppendFormat("{0}{1}", array[i].ToString(), separator)); @@ -932,9 +932,8 @@ namespace SocketHttpListener /// </param> public static Uri ToUri(this string uriString) { - Uri res; return Uri.TryCreate( - uriString, uriString.MaybeUri() ? UriKind.Absolute : UriKind.Relative, out res) + uriString, uriString.MaybeUri() ? UriKind.Absolute : UriKind.Relative, out var res) ? res : null; } @@ -958,4 +957,4 @@ namespace SocketHttpListener #endregion } -}
\ No newline at end of file +} |
