开发者

How can I use ref in WCF?

开发者 https://www.devze.com 2023-04-06 03:56 出处:网络
Can\'t I use ref in WCF to return data ? This is my WCF file. public myDataset SearchInfo(string accountName, string accountId, ref

Can't I use ref in WCF to return data ?

This is my WCF file.

public myDataset SearchInfo(string accountName, string accountId, ref int totalRecords)

Although totalRecords is a non-zero number, I always get 0. I have to get both myDataset and totalRecords. 开发者_如何学PythonHow should I try? I am new to WCF.

Thanks in advance.

UPDATE :

It works well. My bad !!!


If you're trying to return multiple values, it's probably better to add a data contract with a data member for each value (dataset and total records in your case).

[DataContract]
public class SearchInfoResult
{
  [DataMember]
  public myDataSet DataSet {get; set;}

  [DataMember]
  public int TotalRecords {get; set;}
}
0

精彩评论

暂无评论...
验证码 换一张
取 消