C# serializing xsi:type and xsd?

Use a derived type, and an XmlInclude attribute. For example.

Use a derived type, and an XmlInclude attribute. For example: public class Book { public string Title; public string Author; } public class MyBookType : Book { } XmlInclude(typeof(MyBookType)) XmlRoot("Books") public class Books : List { } public void Run() { var be = new Books(); b. Add(new MyBookType { Title = "The Art of War", Author = "Sun Tzu" }); b.

Add(new MyBookType { Title = "Great Expectations", Author = "Charles Dickens" }); var s = new XmlSerializer(typeof(Books)); s. Serialize(Console. Out, b); } Running this produces this output: The Art of War Sun Tzu Great Expectations Charles Dickens Since you're using a SOAP request, I'm assuming ASMX, which means the serialization happens implicitly.

You will need to apply XmlInclude to whatever holds the collection of books. This could be a parameter in a webmethod, for example. You can automatically generate the appropriate XmlInclude attribute, starting from XSD and WSDL, if you define the types in XSD, with the inheritance relationship I illustrated in C# code.In WSDL, the request message might take a Books type, which is a collection of Book.

Separately, define a MyBookType which derives from Book but does not extend it.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions