public override DataSet Clone() { CommonDataSet set = (CommonDataSet)base.Clone(); set.InitVars(); set.SchemaSerializationMode = this.SchemaSerializationMode; return(set); }
public static XmlSchemaComplexType GetTypedDataSetSchema(XmlSchemaSet xs) { CommonDataSet set = new CommonDataSet(); XmlSchemaComplexType type = new XmlSchemaComplexType(); XmlSchemaSequence sequence = new XmlSchemaSequence(); XmlSchemaAny item = new XmlSchemaAny { Namespace = set.Namespace }; sequence.Items.Add(item); type.Particle = sequence; XmlSchema schemaSerializable = set.GetSchemaSerializable(); if (xs.Contains(schemaSerializable.TargetNamespace)) { MemoryStream stream = new MemoryStream(); MemoryStream stream2 = new MemoryStream(); try { XmlSchema current = null; schemaSerializable.Write(stream); IEnumerator enumerator = xs.Schemas(schemaSerializable.TargetNamespace).GetEnumerator(); while (enumerator.MoveNext()) { current = (XmlSchema)enumerator.Current; stream2.SetLength(0L); current.Write(stream2); if (stream.Length == stream2.Length) { stream.Position = 0L; stream2.Position = 0L; while ((stream.Position != stream.Length) && (stream.ReadByte() == stream2.ReadByte())) { } if (stream.Position == stream.Length) { return(type); } } } } finally { if (stream != null) { stream.Close(); } if (stream2 != null) { stream2.Close(); } } } xs.Add(schemaSerializable); return(type); }