public static bool IsUtf16LEString(byte[] bytes)
{
if (bytes == null)
{
return false;
}
int len = bytes.Length;
if (len % 2 != 0)
{
return false;
}
for (int i = 1; i < len; i += 2)
{
if (bytes[i] != '\0')
{
return false;
}
}
if (bytes[len - 2] == '\0' && bytes[len - 1] == '\0')
{
return true;
}
return false;
}