Comparing Arrays using LINQ in C#

前端 未结 6 941
闹比i
闹比i 2020-12-15 04:46

I\'ve two arrays like

string[] a = { \"a\", \"b\", \"c\" };
string[] b = { \"a\", \"b\", \"c\" };

I need to compare the two arrays using LI

6条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-15 05:47

    I think this will always be an O(n log n) operation, so I'd just sort both arrays and compare them e.g. using SequenceEqual.

提交回复
热议问题