private void EncodeDataTypeSchemaHeaderStructure(Stream outputStream) { // Namespaces int nameSpaceLength = -1; if (Namespaces != null) { nameSpaceLength = Namespaces.Count; } BaseType.WriteToStream(outputStream, BitConverter.GetBytes(nameSpaceLength)); for (int i = 0; i < nameSpaceLength; i++) { String nameSpace = Namespaces[i] ?? new String(); nameSpace.Encode(outputStream); } // Structures int structureLength = -1; if (StructureDataTypes != null) { structureLength = StructureDataTypes.Count; } BaseType.WriteToStream(outputStream, BitConverter.GetBytes(structureLength)); if (StructureDataTypes != null) { List <StructureDescription> structureDescriptions = StructureDataTypes.Values.ToList(); for (int i = 0; i < structureLength; i++) { StructureDescription desc = structureDescriptions[i] ?? new StructureDescription(); desc.Encode(outputStream); } } // Enums int enumLength = -1; if (EnumDataTypes != null) { enumLength = EnumDataTypes.Count; } BaseType.WriteToStream(outputStream, BitConverter.GetBytes(enumLength)); if (EnumDataTypes != null) { List <EnumDescription> enumDescriptions = EnumDataTypes.Values.ToList(); for (int i = 0; i < enumLength; i++) { EnumDescription desc = enumDescriptions[i] ?? new EnumDescription(); desc.Encode(outputStream); } } // Simple Data Types int simpleTypesArraySize = -1; BaseType.WriteToStream(outputStream, BitConverter.GetBytes(simpleTypesArraySize)); }