public static void WriteStringDictionary(Dictionary <string, string> dictionary, BinaryWriter binaryWriter) { MyMwcMessageOut.WriteInt32(dictionary.Count, binaryWriter); foreach (var item in dictionary) { MyMwcMessageOut.WriteString(item.Key, binaryWriter); MyMwcMessageOut.WriteNullableString(item.Value, binaryWriter); } }
public static void WriteNullableString(string value, BinaryWriter binaryWriter) { bool hasValue = value != null; MyMwcMessageOut.WriteBool(hasValue, binaryWriter); if (hasValue) { MyMwcMessageOut.WriteString(value, binaryWriter); } }