For the private array variable I tried writing the indexed property:
public float this [int index]
{
get
{
return m_Price[index];
}
set
{
m_Price[index] = value;
}
}
Still this is not sufficient. The get/set proerty must be written as:
public float[] Price
{
get
{
return m_Price;
}
set
{
m_Price = value;
}
}
More about SerializableAttribute on: http://msdn2.microsoft.com/en-us/library/system.serializableattribute(vs.80).aspx
If the attribute serializes all public, private fields then why get/set is required? L
While sending custom object from web service, the serialization of object could also be achieved by using “System.Xml.Serialization.XmlInclude” instead of “Serializable” attribute.
The code like
[System.Xml.Serialization.XmlInclude(typeof(MarketInformation. PriceInformation))];
should be added instead of [Serializable] attribute.
If you don’t have access to the class code base then it could be added on top of the web method using it. Like following:
[WebMethod]
[System.Xml.Serialization.XmlInclude(typeof(MarketInformation. PriceInformation))];
public PriceInformation GetPriceInfo()
{
PriceInformation price = new PriceInformation ();
return price;
}
No comments:
Post a Comment