Skip to content

Commit df01a1e

Browse files
committed
[Modify] Polish it
1 parent b56281b commit df01a1e

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

websocket-sharp/Ext.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1651,6 +1651,7 @@ public static T[] SubArray<T> (this T[] array, int startIndex, int length)
16511651
throw new ArgumentNullException ("array");
16521652

16531653
var len = array.Length;
1654+
16541655
if (len == 0) {
16551656
if (startIndex != 0)
16561657
throw new ArgumentOutOfRangeException ("startIndex");
@@ -1673,10 +1674,11 @@ public static T[] SubArray<T> (this T[] array, int startIndex, int length)
16731674
if (length == len)
16741675
return array;
16751676

1676-
var subArray = new T[length];
1677-
Array.Copy (array, startIndex, subArray, 0, length);
1677+
var ret = new T[length];
16781678

1679-
return subArray;
1679+
Array.Copy (array, startIndex, ret, 0, length);
1680+
1681+
return ret;
16801682
}
16811683

16821684
/// <summary>

0 commit comments

Comments
 (0)