gpt4 book ai didi

c# - Collection of Collections 是否可能和/或最好的方式? C#.Net 3.5

转载 作者:太空狗 更新时间:2023-10-30 00:13:29 25 4
gpt4 key购买 nike

我已经为仪表板项目创建了一个类,它将保存诸如在仪表板上的位置、描述等信息。我目前正在使用一对集合来保存包含在“库”中的那些仪表板项目和显示的那些项目在仪表板上。我被要求制作这个仪表板的多选项卡,我的第一个想法是为每个选项卡制作一个新的集合。为此,我想要某种类型的数组或集合,随着更多选项卡被添加到仪表板,它们可以添加许多这样的仪表板项目集合。

这可能吗?如果可能的话,我可以得到一些用于声明此类集合的代码片段吗?我考虑过使用带有变量的单个集合来显示项目将显示在哪个选项卡中...但是,管理屏幕和库之间的仪表板项目移动的显示和例程目前需要这些单独的集合。

编辑:感谢您的回答。虽然我确实发现它们都很有趣,但我相信我会选择 James 解决方案并将其标记为已接受的答案。

最佳答案

List< List<Placement>> ListofListOfPlacements = new List< List<Placement>> ();

List<Placement> dashboard1 = new List<Placement>();
List<Placement> dashboard2 = new List<Placement>();
List<Placement> dashboard3 = new List<Placement>();
List<Placement> dashboard4 = new List<Placement>();

ListofListOfPlacements.Add(dashboard1);
ListofListOfPlacements.Add(dashboard2);
ListofListOfPlacements.Add(dashboard3);
ListofListOfPlacements.Add(dashboard4);

关于c# - Collection of Collections 是否可能和/或最好的方式? C#.Net 3.5,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/240016/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com