.NET Dictionary as a Property

后端 未结 8 487
-上瘾入骨i
-上瘾入骨i 2021-02-02 08:30

Can someone point me out to some C# code examples or provide some code, where a Dictionary has been used as a property for a Class.

The examples I have seen so far don\'

相关标签:
8条回答
  • 2021-02-02 09:25

    Since .net 4.6 you can also define a Dictionary like this:

    private Dictionary<string,int> Values => new Dictionary<string, int>()
    {
        { "Value_1", 1},
        { "Value_2", 2},
        { "Value_3", 3},
    };
    

    It's called Expression-bodied members!

    0 讨论(0)
  • 2021-02-02 09:34

    You mean like a property bag ?

    http://www.codeproject.com/KB/recipes/propertybag.aspx

    0 讨论(0)
提交回复
热议问题