V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
• 请不要在回答技术问题时复制粘贴 AI 生成的内容
ligiggy
V2EX  ›  程序员

怎么撸三个数据类型的集合

  •  
  •   ligiggy · Sep 4, 2020 · 1403 views
    This topic created in 2074 days ago, the information mentioned may be changed or developed.

    基于 C#,需要建立一个数量大概在几百的,为<int,string,string>的集合,目前的想法有如下两种:

    • Tuple<int,string,string>很好实现,但是可读性很差

    • 采用面对对象的思想,建立三个对应属性,然后用数组将数据结合起来

    想知道,还有没有其他更好的办法

    3 replies    2020-09-04 22:53:56 +08:00
    noreplay
        1
    noreplay  
       Sep 4, 2020 via Android
    写他三个集合。
    h30356764
        2
    h30356764  
       Sep 4, 2020
    并行数组,三个集合吧,反正也不是太复杂
    ligiggy
        3
    ligiggy  
    OP
       Sep 4, 2020 via Android
    @h30356764 最后用了双 dictionary,方便查询
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5594 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 50ms · UTC 05:51 · PVG 13:51 · LAX 22:51 · JFK 01:51
    ♥ Do have faith in what you're doing.