在对象列表中获取组合所需的帮助 [英] Help needed to Get Combinations in a list of objects
问题描述
我有一个对象列表
例如:List< classname> mylist = new List< classname>();
eg: List<classname> mylist=new List<classname>();
test1,name1,value1
test1, name1 , value1
test1,name2,value2
test1, name2, value2
test2,名称1,值1
test2, name1, value1
test2,name3,值3
test2, name3, value 3
test3,name1,value3
test3, name1, value3
我需要获取组合,其中每个组合应具有 test1,test2和test3项目
i need to get combinations in which each combination should have test1 , test2 , test3 items
例如:一个组合是 test1,name1,value1
for eg: one combination would be test1, name1 , value1
test2,名称1,值1
test2, name1, value1
test3,name1,value3
test3, name1, value3
推荐答案
我不太确定我是否遵循您定义的组合.您是否正在寻找每个项目与另一个项目的所有组合?例如,如果您的列表包含A,B和C,那么您想要(A,B),(A,C),(B,C)吗?如果是这样,那么这是一个常见的论坛 要求.我将指出您
I'm not quite sure I follow what you are defining to be a combination. Are you looking for all combinations of each item to another item? For example if your list contains A, B and C then you want the (A,B), (A,C), (B,C)? If so then this is a common forum request. I'll point you to one of the solutions that have already been given.
迈克尔·泰勒
http://www.michaeltaylorp3.net
Michael Taylor
http://www.michaeltaylorp3.net
这篇关于在对象列表中获取组合所需的帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!