how to initialize dictionary as (key,value,value) pair in C#

后端 未结 9 1154
悲&欢浪女
悲&欢浪女 2020-12-31 11:37

I want to store values as key,value,value pair. My data is of type

Key -> int & both values -> ulong,

How to initialize & fet

9条回答
  •  悲哀的现实
    2020-12-31 12:21

    You can declare a class that stores both values and then use an ordinary dictionary. For example:

    class Values {
        ulong Value1 {get;set;}
        ulong Value2 {get;set;}
    }
    
    var theDictionary=new Dictionary;
    
    theDictionary.Add(1, new Values {Value1=2, Value2=3});
    

提交回复
热议问题