0

I do have a python code that has nested dictionaries. The python code is as follows:

T_DICT = {
       "ABC_Table":
           {
             "table": "ABC",
             "schema": "XYZ",
             "columns": 
                 { 
                   'Id': {"type": 'bigint', "name": "[ID]", 'IsIden': True, 'IsNull': False},
                   'T_ID': {"type": 'bigint', "name": "Tsa", 'IsIden': False, 'IsNull': False},
                 }
           }
         }

I wanted to do the same thing in C#. Please can anyone help me with how to do the same thing in C#?

2
  • 3
    What have you done and where are you stuck? Telling us what you want to happen is not a problem statement. We're not here to make it happen for you. If you haven't tried anything then you haven't encountered an actual iss yet. Commented Sep 25, 2022 at 6:54
  • Does this answer your question? C# nested dictionaries Commented Sep 25, 2022 at 8:25

1 Answer 1

2
T_DICT = { 
    "ABC_Table": { 
        "table": "ABC", 
        "schema": "XYZ", 
        "columns": { 
            'Id': {
                "type": 'bigint', 
                "name": "[ID]", 
                'IsIden': True, 
                'IsNull': False
            }, 
            'T_ID': {
                "type": 'bigint', 
                "name": "Tsa", 
                'IsIden': False, 
                'IsNull': False
            }, 
        } 
    } 
}

I think you forgot a " after "[ID].


public Dictionary<string, Dictionary<string, Dictionary<string, string>>>

This type is similar to what you need, but won't allow you to put the keys "table" and "schema".


So, for what you really need... C#: Using a generic dictionary <key, object> to hold settings of mixed type and return correct value and typecast

I don't think there's a clean solution for this.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.