Is it possible to extend XSD generated classes with methods and properties?
I have a schema with around 200 complexTypes. I'd like to provide methods for many of them. My first approach was use XSD.exe to generate classes for the complexTypes (in the 'commonNamespace' namespace), to derive a new CS class from the XSD generated class, and to provide the methods there. However, that doesn't serialize. Here's a copy of my subclass : namespace commonNamespace { [System.Xml.Serialization.XmlTypeAttribute( Namespace="myURI", TypeName="Type_t")] public class myType : Type_t // Type_t is a class generated by XSD.exe in the commonNamespace namespace { void doIt() { // execute my business logic } } } I have a root element in my schema that has a Type_t element in it. If my C# code constructs a myType, populates the relevant fields, and then serializes it, I get System.InvalidOperationException on my XmlSerializer.Serialize() call. If I change my C# to populate a Type_t instead of a myType, then it works. Is there something I can do without hand-editing the generated C# code to make this work? It doesn't appear that you can pass XmlIncludeAttributes to the XmlAttributesOverrides.Add() method. Thanks in advance, Howard You can read messages from the Advanced DOTNET archive, unsubscribe from Advanced DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com.