-1

I am trying to populate ddlCustomerType from XML using JSON. I am having one method which gives me key and value.

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

My problem is I am able to view data inside in Quickwatch but when I am trying to fetch its showing the following error:

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

Here you can check the image for same.

Can any body tell me how I can fetch records?

Biswabid
  • 1,378
  • 11
  • 26
  • I found that class declared with `internal sealed class Mscorlib_DictionaryDebugView`, so is `listCustomerType` a Sharepoint-related list? – Tetsuya Yamamoto Apr 25 '17 at 07:06

2 Answers2

1

If you are trying to use Mscorlib_DictionaryDebugView then you cant. It is an internal object not meant for pubic use here is the source where you can see its marked internal sealed.

If you post a question about what you are trying to achieve maybe we can direct you to a more suitable solution.

Community
  • 1
  • 1
Andrew Harris
  • 1,419
  • 2
  • 17
  • 29
  • thank you for quick response. I got the point but can you tell me how I can find the solution? I am getting details in variable but how I fetch value and key from that. I tried to receive it in List but then I only got the name and not the value. – Rajeev Ranjan Tiwary Apr 25 '17 at 07:17
1

It was very simple. I don't know why I fall for getting data from Mscorlib_DictionaryDebugView. Funny...isn't it?

I fetch the details in dictionary like follow:

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

and then I used a loop to fetch the key and value like following:

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

Thank you all for help.

  • 1
    So if your question had actually detailed the line of code that was throwing the error we probably could have helped you sooner. – Andrew Harris Apr 26 '17 at 08:18