Add project
Basic formatting applied. Unnecessary comments have been removed. Suspicious code is covered by TODO.
This commit is contained in:
38
Hcs.Client/GostXades/Helpers/ArrayHelper.cs
Normal file
38
Hcs.Client/GostXades/Helpers/ArrayHelper.cs
Normal file
@ -0,0 +1,38 @@
|
||||
using System;
|
||||
|
||||
namespace Hcs.GostXades.Helpers
|
||||
{
|
||||
public static class ArrayHelper
|
||||
{
|
||||
public static bool AreEquals(byte[] first, byte[] second)
|
||||
{
|
||||
return AreEquals(first, second, (x, y) => x.Equals(y));
|
||||
}
|
||||
|
||||
public static bool AreEquals(string[] first, string[] second)
|
||||
{
|
||||
return AreEquals(first, second, (x, y) => string.Equals(x, y, StringComparison.InvariantCultureIgnoreCase));
|
||||
}
|
||||
|
||||
private static bool AreEquals<T>(T[] first, T[] second, Func<T, T, bool> comparator)
|
||||
{
|
||||
if (first == second)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (first.Length != second.Length)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
for (var i = 0; i < first.Length; i++)
|
||||
{
|
||||
var equals = comparator.Invoke(first[i], second[i]);
|
||||
if (!equals)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user