存储两个值的组合 [英] Store a two value combination

查看:23
本文介绍了存储两个值的组合的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想存储两个值的组合,但找不到正确的类.我知道我可以用二维数组来做到这一点,但还有另一种方法,因为我总是必须进行重新定位.我知道字典,但第一个值总是关键.

I want to store a two value combination but cannot find the right class. I know I could do it with a two dimentional array but is there another way since I always have to do the redimentionalisation. I know about the dictionary but there is the first value always the key.

示例:我有一个 dgv,想收集重复的行号.我遍历 dgv 并收集 1 和 4、20 和 33 等等,并将这些组合存储起来以在其他地方使用它们.

Example: I have a dgv and want to collect the rownumbers with duplicates. I iterate throu the dgv and collect 1 and 4, 20 and 33 and so on and store this combinations to use them somewhere else.

推荐答案

您可以使用 元组.例如:

Dim tuples As New List(Of Tuple(Of Integer, Integer))
tuples.Add(Tuple.Create(1, 4))
tuples.Add(Tuple.Create(20, 33))

这篇关于存储两个值的组合的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆