2010-03-06 26 views
1

我有一個用C#編寫的函數,它有一個參數類型Dictionary<string , string>。當我嘗試在VB.Net中調用此函數時,它不顯示類型爲Dictionary<string , string>它顯示爲string。下面是我的函數將函數參數調用爲泛型字典從C#到vb.net中的問題

public bool RegisterCustomerAttribute(int CustomerId 
              , Dictionary<string , string> dictAttribute) 
    { 
     try 
     { 

      List<string> keys = new List<string>(dictAttribute.Keys); 

      foreach (string key in keys) 
      { 
       CustomerAttribute custattr = new CustomerAttribute(); 

       custattr.Customer.CustomerID = CustomerId; 
       custattr.Key = key; 
       custattr.Value = dictAttribute[key]; 

       customerattrepo.AddCustomerAttribute(custattr); 

      } 

      return true; 
     } 
     catch (Exception ex) 
     { 
      string strMsg = ex.Message; 
      return false; 
     } 
    } 

alt text http://i46.tinypic.com/qsv6fa.png

+2

您是否在舊簽名到新簽名的某個時刻更改了'RegisterCustomerAttribute'方法?您必須重建C#項目才能顯示在您的VB.NET代碼中。 – 2010-03-06 16:06:08

+0

你是200%的權利。我身邊的小錯誤.. – 2010-03-06 17:30:29

回答

0

起初我以爲可能有一個重載,只需要一個鍵和值,但是你會看到至少在智能感知了這一個選項。所以,相反,我敢打賭它正在尋找舊的或過時的代碼—,您需要在Visual Studio中的VB項目中重新加載對c#項目的引用。