C#-WCF中传输List对象

遇到的问题:

  C#WCF客户端生成的服务默认把集合List<>转化为数组[],我们可以用下列对策:

对策一:客户端可以使用IList接收:

  服务端

public interface ISqliteManagerWcfS
{
// TODO: 在此添加您的服务操作 [OperationContract] List<CommentDataModel> GetCommentData();
}

  客户端

            SqliteManagerWcfSClient sqliteManagerWcfSClient = new SqliteManagerWcfSClient();
            IList<CommentDataModel> ss = sqliteManagerWcfSClient.GetCommentData();

 

posted @ 2021-02-24 17:06  ꧁执笔小白꧂  阅读(226)  评论(0编辑  收藏  举报