Efficiently merge string arrays in .NET, keeping distinct values

前端 未结 6 1613
迷失自我
迷失自我 2021-02-02 06:38

I\'m using .NET 3.5. I have two string arrays, which may share one or more values:

string[] list1 = new string[] { \"apple\", \"orange\", \"banana\" };
string[]         


        
6条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-02-02 06:48

    Probably creating a hashtable with your values as keys (only adding those not already present) and then converting the keys to an array could be a viable solution.

提交回复
热议问题