[Modify] Polish it
This commit is contained in:
parent
86cd0ec022
commit
9f19953490
@ -212,21 +212,23 @@ namespace WebSocketSharp
|
|||||||
internal static bool ContainsTwice (this string[] values)
|
internal static bool ContainsTwice (this string[] values)
|
||||||
{
|
{
|
||||||
var len = values.Length;
|
var len = values.Length;
|
||||||
|
var end = len - 1;
|
||||||
|
|
||||||
Func<int, bool> contains = null;
|
Func<int, bool> seek = null;
|
||||||
contains = idx => {
|
seek = idx => {
|
||||||
if (idx < len - 1) {
|
if (idx == end)
|
||||||
for (var i = idx + 1; i < len; i++)
|
return false;
|
||||||
if (values[i] == values[idx])
|
|
||||||
|
var val = values[idx];
|
||||||
|
for (var i = idx + 1; i < len; i++) {
|
||||||
|
if (values[i] == val)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return contains (++idx);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return seek (++idx);
|
||||||
};
|
};
|
||||||
|
|
||||||
return contains (0);
|
return seek (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static T[] Copy<T> (this T[] source, int length)
|
internal static T[] Copy<T> (this T[] source, int length)
|
||||||
|
Loading…
Reference in New Issue
Block a user