将double [,]定义为Datamember

时间:2011-03-08 11:29:14

标签: wcf

是否可以将double [,]定义为datamember? 如果没有,是否有某种方法可以将看起来像二维数组的东西定义为datamember?

1 个答案:

答案 0 :(得分:3)

[DataContract]
public class Data
{
    [DataMember]
    double[][] JaggedArray { get; set; }

    public Data()
    {
        int count = 10;
        JaggedArray = new double[ count ][];
        for ( int i = 0; i < count; i++ )
        {
            JaggedArray[ i ] = new double[ count ];
        }
    }
}