2010-08-16 17 views
0

我從WCF提供一個List,並且客戶端接收DocTypes []。那裏沒有問題。WCF List <>在客戶端收到爲[],如何使用[]

目前的情況是,我的客戶端只接受100個DocType中的1,2個。將[100]濃縮爲2的最佳方式是什麼?

我有這個代碼用於標記用戶從網格中檢查的內容。

foreach (GridViewRow rowItem in gvDocTypes.Rows) 
      { 
       chk = (CheckBox)(rowItem.Cells[0].FindControl("chk1")); 
       if (chk.Checked) 
        DFO[y].Process = true; 
       y++; 
      } 

這是數據收集模式:

我覺得
[System.NonSerializedAttribute()] 
     private System.Runtime.Serialization.ExtensionDataObject extensionDataField; 
     private int DocTypeGroupField; 
     private System.Guid DocTypeIDField; 
     private string DocTypeNameField; 
     private int DocTypeNumberField; 
     private string ErrorMsgField; 
     private bool ProcessField; 

最佳做法是命名這個對象的克隆,並根據需要添加在通過網格我的迭代。我無法在新陣列中獲得我的出發點?

試過這樣:

Service.DocTypes dfo = new Service.DocTypes() ; 
Service.DocTypes[] DFO = (Service.DocTypes[])Session["oDocTypes"]; 
Service.DocTypes[] oDFO = DFO.Clone(); 

我缺少什麼?

TIA

斯蒂芬

回答

2

如果使用添加服務引用創建爲您服務代理,你可以定義應該產生什麼類型的集合。默認是System.Array,但您可以選擇System.Collections.Generic.List。

最好的問候,拉吉斯拉夫

0

在Visual Studio中,右鍵單擊服務引用添加引用,然後選擇「配置服務引用」。將「System.Array」中的「集合類型」更改爲「System.Collections.Generic.List」,然後您可以將它們視爲客戶端的列表。

相關問題