考虑以下代码:
[DataContract]
class QObject {
public QObject() { }
[DataMember(Name = "objectindex")]
public int ObjectIndex { get; set; }
[DataMember(Name = "datapoint")]
public int DataPoint { get; set; }
[DataMember(Name = "type")]
public string Type { get; set; }
[DataMember(Name = "data")]
public int[] Data { get; set; }
[DataMember(Name = "parameters")]
public string __Parameters {
get {
return this.__Parameters;
}
set {
Parameters = new Dictionary<string,string>();
Parameters.Add("key", "value");
}
}
public Dictionary<string, string> Parameters;
}
这对我来说似乎很好,但是当我想编译时,它会出现以下错误:
'QuartzService.NET.QObject.__Parameters.get' 必须声明一个主体,因为它没有标记为抽象、外部或部分
奇怪的是,get声明了一个主体。那么,如何解决这个问题?