What's the best way of using a pair (triple, etc) of values as one value in C#?

前端 未结 16 2271
时光说笑
时光说笑 2021-02-07 03:00

That is, I\'d like to have a tuple of values.

The use case on my mind:

Dictionary, object>

or

<         


        
16条回答
  •  甜味超标
    2021-02-07 03:48

    NGenerics - the popular .Net algorithms and data structures library, has recently introduced immutable data structures to the set.

    The first immutable ones to implement were pair and tuple classes. The code is well covered with tests and is quite elegant. You can check it here. They are working on the other immutable alternatives at the moment and they should be ready shortly.

提交回复
热议问题