diff options
| author | Joshua M. Boniface <joshua@boniface.me> | 2019-01-13 12:14:53 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-01-13 12:14:53 -0500 |
| commit | 9dcaafe700b7130b49bafbadf0d47b37c6ecf53b (patch) | |
| tree | 6ca1b2b3decac1a86b886dafd2645954a13601fd /SocketHttpListener/Ext.cs | |
| parent | 17d8de4962ea9d78f6ddb557fe26465be1944b38 (diff) | |
| parent | b936c439321b55bf89c99dac96fc78cefe752e84 (diff) | |
Merge pull request #458 from EraYaN/code-cleanup
Clean up several minor issues and add TODOs
Diffstat (limited to 'SocketHttpListener/Ext.cs')
| -rw-r--r-- | SocketHttpListener/Ext.cs | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/SocketHttpListener/Ext.cs b/SocketHttpListener/Ext.cs index 125775180..4404235ba 100644 --- a/SocketHttpListener/Ext.cs +++ b/SocketHttpListener/Ext.cs @@ -149,7 +149,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 +222,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 +248,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 +329,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) @@ -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)); |
