Search code examples
c#arrayswcfservice

How to send an array of objects to a WCF service?


I am trying to pass the following to call of WCF service function, but it doesn't receive it.

    [DataContract]
    public class Sheet
    {
        [DataMember]
        public string SheetName {get; set; }

        [DataMember]
        public Row[] RowList { get; set; }
    }

    [DataContract]
    public class Row
    {
        [DataMember]
        public string[] ColumnValues { get; set; }
    }

public ResultData CreateExcel(out string fileName, string prefixName2, Sheet[] sheetList) 
{...}

Do you have any idea what I am doing wrong?


Solution

  • I am not sure that arrays are cause of your trouble. Try from simple prototype code and step by step add your logic. Could you specify details:

    1. Which kind of errors you were received?
    2. What does CreateExcel method in your code?

    Check out next article - Collection Types in Data Contracts. Possible that helps you.