0

I have a problem with serialization composite class (using WCF Service).

here my class in namespace1 (it is not in service namespace) :

 [DataContract]
    public class UpData
    {
        [DataMember]
        public double Version ;

        public UpData()
        {
            this.Version = -1;    
        }
    }

In my Service namespace (in interface) I deсlare this procedure :

ArrayList GetDownloadPath(Dictionary<string,string> lib1, Dictionary<string,string> lib2);

ArrayList contains UpData objects.

I have error(

How will be right to send ArrayList of UpData objects? (may be specific DataContract?)

Thanks a lot!

4

1 回答 1

0

我不确定ArrayList默认情况下是否可序列化。使用通用列表可以解决您的问题:

[OperationContract]
List<UpData> GetDownloadPath(Dictionary<string,string> lib1, Dictionary<string,string> lib2);

编辑:我认为您还需要为您的Version属性指定一个 getter 和 setter,即

[DataContract]
public class UpData
{
    [DataMember]
    public double Version { get; set; }

    public UpData()
    {
        this.Version = -1;    
    }
}

更多信息在这里

于 2011-12-13T08:20:38.403 回答