I have this class Schedule which I return from a WCF function. When I add the service reference in visual studio, I'm unable to see the StartTime and EndTime properties instead I get this weird ExtensionData field. Can any one explain why this is happening?
public class Schedule
{
public Duration SD开发者_C百科uration
{
get; set;
}
public Timeslot STimeslot
{
get; set;
}
}
public class Timeslot
{
public DateTime StartTime;
{
get; set;
}
public DateTime EndTime;
{
get; set;
}
public bool SomeFunc()
{
}
}
As Fredrik mentioned in the comment, the classes must be decorated with [DataContract]
and [DataMember]
for it to work.
...because you didn't specified the DataContract attribute, by default it used the Serializable attribute. the serializable attribute then includes all the Fields you got in your class (none, as those are properties), therefore those property information are stored in the ExtensionData.
精彩评论