سؤال

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?

هل كانت مفيدة؟

المحلول

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

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top