ln.types/Extensions.cs

32 lines
747 B
C#

using System;
using System.IO;
namespace ln.types
{
public static class Extensions
{
public static bool AreEqual<T>(this T[] me,T[] you)
{
if (me.Length != you.Length)
return false;
for (int n = 0; n < me.Length; n++)
if (!me[n].Equals(you[n]))
return false;
return true;
}
public static int ReadInteger(this Stream stream)
{
byte[] b = new byte[4];
stream.Read(b, 0, 4);
return BitConverter.ToInt32(b,0);
}
public static void WriteInteger(this Stream stream,int i)
{
stream.Write(BitConverter.GetBytes(i), 0, 4);
}
}
}