in src/Proton.TestPeer/Codec/Impl/Codec.cs [632:748]
public void PutObject(object o)
{
if (o == null)
{
PutNull();
}
else if (o is bool boolean)
{
PutBoolean(boolean);
}
else if (o is byte byte1)
{
PutUnsignedByte(byte1);
}
else if (o is sbyte @byte)
{
PutByte(@byte);
}
else if (o is ushort int5)
{
PutUnsignedShort(int5);
}
else if (o is short int4)
{
PutShort(int4);
}
else if (o is uint int3)
{
PutUnsignedInteger(int3);
}
else if (o is int int2)
{
PutInt(int2);
}
else if (o is char @char)
{
PutChar(@char);
}
else if (o is ulong int1)
{
PutUnsignedLong(int1);
}
else if (o is long @int)
{
PutLong(@int);
}
else if (o is DateTime time)
{
PutTimestamp(time);
}
else if (o is float single)
{
PutFloat(single);
}
else if (o is double @double)
{
PutDouble(@double);
}
else if (o is Decimal32 decimal2)
{
PutDecimal32(decimal2);
}
else if (o is Decimal64 decimal1)
{
PutDecimal64(decimal1);
}
else if (o is Decimal128 @decimal)
{
PutDecimal128(@decimal);
}
else if (o is Guid guid)
{
PutUUID(guid);
}
else if (o is Binary binary)
{
PutBinary(binary);
}
else if (o is string @string)
{
PutString(@string);
}
else if (o is Symbol symbol)
{
PutSymbol(symbol);
}
else if (o is IDescribedType type)
{
PutDescribedType(type);
}
else if (o is Symbol[] v)
{
PutArray(false, DataType.Symbol);
Enter();
foreach (Symbol s in v)
{
PutSymbol(s);
}
Exit();
}
else if (o is object[])
{
throw new ArgumentException("Unsupported array type");
}
else if (o is IList list)
{
PutPrimitiveList(list);
}
else if (o is IDictionary dictionary)
{
PutPrimitiveMap(dictionary);
}
else
{
throw new ArgumentException("Unknown type " + o.GetType().Name);
}
}