//variant public void Write(object val) { if (val == null) { throw new NotSupportedException("Cannot send null variant"); } if (val is DValue) { DValue dv = (DValue)val; if (dv.endianness != endianness) { throw new NotImplementedException("Writing opposite endian DValues not yet implemented."); } Write(dv.signature); WritePad(dv.signature.Alignment); stream.Write(dv.data, 0, dv.data.Length); return; } Type type = val.GetType(); WriteVariant(type, val); }
//variant public void Write(object val) { if (val == null) { throw new NotSupportedException("Cannot send null variant"); } if (val is DValue) { DValue dv = (DValue)val; if (dv.endianness != endianness) { throw new NotImplementedException("Writing opposite endian DValues not yet implemented."); } Write(dv.signature); WritePad(dv.signature.Alignment); stream.Write(dv.data, 0, dv.data.Length); return; } Type type = val.GetType(); // TODO: workaround issue with array being written as variant // See PR for context: https://github.com/mono/dbus-sharp/pull/58 if (type.IsArray) { Write(type, val); } else { WriteVariant(type, val); } }