zoukankan      html  css  js  c++  java
  • Error

    Error Cannot convert from 'System.Collections.Generic.List<int>' to 'System.Collection.ObjectModel.ObservableCollection<int>'

     Hi,

    I am using WCF Webservice to transfer the data from Silverlight  to ASP.NET.
    I have some List<> variable like List<int> or List<string>. I got this error when I build my solution:

    cannot convert from 'System.Collections.Generic.List<int>' to 'System.Collection.ObjectModel.ObservableCollection<int>'

    Here is my code:

    #1. DataWebService.svc in asp.net

    [OperationContract]
    public void ReceiveDataFromSL(List<int> dataList1, List<string> dataList2)
     {

         // do something with dataList1 & dataList2

     #2. In Silverlight page where call the web service

        List<int> myList1 = new List<int>();

        List<string> myList2 = new List<string>(); 

        // add data to myList1 & myList2

        // declare using webservice 

        service.ReceiveDataFromSLAsync(myList1, myList2)      => the error is here!!! cannot convert from 'System.Collections.Generic.List<int>' to                        
                                                                                    'System.Collection.ObjectModel.ObservableCollection<int>'

     Could you please give me a solution for this problem? I want to use List receive from SL in webservice.

    Hope to see your reply soon!!!

    Waiting for reply... 

    Thank you and Regards,

    John.
    Answered Question

    Re: Re: Error Cannot convert from 'System.Collections.Generic.List&lt;int&gt;' to 'System.Collection.ObjectModel.ObservableCollection&lt;int&gt;'

    RightClicking on your ServiceReference in Solution Explorer

    Choose Configure Service Reference

    on the Collection Type -> change to Generic List

  • 相关阅读:
    Unity3D 系统宏
    Mac OS—苹果搭建Android开发环境
    CocoaChina六年了,记我的这六年——六年汇总
    我的程序员之路(8)——北京第三家公司工作第一年总结
    Unity插件研究院之ResourceChecker
    Unity3D 插件大全
    MAC中开发Unity3D
    MySql安装过程(以验证)【网络资料】
    .net—— webservice的新建、发布、使用(最全、最简单)【原创】
    EF 链接MySql 建立数据模型
  • 原文地址:https://www.cnblogs.com/zrp201008/p/1876745.html
Copyright © 2011-2022 走看看