Naming convention for a C# Dictionary

后端 未结 6 2113
遇见更好的自我
遇见更好的自我 2020-12-23 11:16

How do we name a dictionary variable?

Say in my method I have Dictionary> dictionary;, where the keys of the dict

6条回答
  •  离开以前
    2020-12-23 11:59

    Naming is always contextual. So in this specific case some name specifying the country to state mapping is appropriate.

    if this was just a device for a loop within a larger context and then discarded, I normally just go with a short temp type var like...

    var dict = GetCountryStateMapping();
    foreach(var item in dict)
    {
      //Something....
    }
    

提交回复
热议问题