public void WriteFromDict(Type keyType, Type valType, System.Collections.IDictionary val)
{
long origPos = stream.Position;
Write ((uint)0);
//advance to the alignment of the element
//WritePad (Protocol.GetAlignment (Signature.TypeToDType (type)));
WritePad (8);
long startPos = stream.Position;
foreach (System.Collections.DictionaryEntry entry in val)
{
WritePad (8);
Write (keyType, entry.Key);
Write (valType, entry.Value);
}
long endPos = stream.Position;
uint ln = (uint)(endPos - startPos);
stream.Position = origPos;
if (ln > Protocol.MaxArrayLength)
throw new Exception ("Dict length " + ln + " exceeds maximum allowed " + Protocol.MaxArrayLength + " bytes");
Write (ln);
stream.Position = endPos;
}