2017-04-25 126 views
-1

我想从使用JSON的XML填充ddlCustomerType。我有一种方法给了我钥匙和价值。'System.Collections.Generic.Mscorlib_DictionaryDebugView <string,string>'由于其保护级别而无法访问

var listCustomerType = GlobalBind.GetXMLFullDetails("CustomerType", GlobalConstString.COMMON_SETTING_XML);

我的问题是,我能够在快速监视窗口中查看数据,但是当我试图获取其显示以下错误:

CS0122:System.Collections.Generic.Mscorlib_DictionaryDebugView<string,string>' is inaccessible due to its protection level

Here you can check the image for same.

任何机构都可以告诉我如何可以获取记录?

+0

我发现用'internal sealed class Mscorlib_DictionaryDebugView '声明的类,'listCustomerType'是一个Sharepoint相关列表吗? –

回答

1

这很简单。我不知道为什么我会从Mscorlib_DictionaryDebugView获取数据。有趣......不是吗?

我取的细节在字典中类似如下:

Dictionary<string, string> listCustomerDetails = GlobalBind.GetXMLFullDetails("CustomerType", GlobalConstString.COMMON_SETTING_XML);

,然后我用一个循环来获取键和值类似以下内容:

 foreach (var customer in listCustomerDetails) 
     { 
      ListItem ls = new ListItem(); 
      ls.Text = customer.Value; 
      ls.Value = customer.Key; 
      listItem.Add(ls); 
     } 

感谢大家的帮助。

+1

因此,如果您的问题实际上详细介绍了引发错误的代码行,我们可能会尽早帮助您。 –

1

如果你想使用Mscorlib_DictionaryDebugView,那么你不能。这是一个内部对象不意味着公共使用here是你可以看到其标记为internal sealed的来源。

如果您发布了关于您正在努力实现的问题,也许我们可以将您引导至更合适的解决方案。

+0

感谢您的快速回复。我明白了,但你能告诉我如何找到解决方案吗?我在变量中获取详细信息,但是如何从中获取值和密钥。我试图收到名单,但后来我只知道名称而不是价值。 –

相关问题