Domanda

I have a class (call it pubs) with some members defined as follows

public string Publisher { get { return PUBLISHER; } }
public string PublisherUrl { get { return PUBLISHER_URL; } }
public DateTime LastBuildDate { get; set; }

Now, an object of this class is serialized and returned as a XMLResult.However, the Publisher and PublisherUrl properties are not part of the XML.

This is being done in the method of my controller which returns an XMLResult (I am using MvcContrib) as follows

return XMlResult(pubs)

Why would the Publisher and PublisherUrl properties not appear in XML?

È stato utile?

Soluzione

XmlSerializer handles only public properties that have both - a public getter and a public setter

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top