public void WriteWithParams(params object[] args)
{
foreach (var v in args)
{
switch (v.GetType().Name)
{
case "Bool": PutBoolean((bool)v); break;
case "Byte": PutByte((byte)v); break;
case "SByte": PutSByte((sbyte)v); break;
case "Char": PutChar((char)v); break;
case "Int16": PutInt16((short)v); break;
case "UInt16": PutUInt16((ushort)v); break;
case "Int32": PutInt32((int)v); break;
case "UInt32": PutUInt32((uint)v); break;
case "Int64": PutInt64((long)v); break;
case "UInt64": PutUInt64((ulong)v); break;
case "String": PutStringAsUtf16((string)v); break;
case "Double": PutDouble((double)v); break;
}
}
}