我有一個字符串的集合是如下:在LINQ爲了忽略串by子句C#
"[Unfinished] Project task 1"
"Some other Piece of work to do"
"[Continued] [Unfinished] Project task 1"
"Project Task 2"
"Random other work to do"
"Project 4"
"[Continued] [Continued] Project task 1"
"[SPIKE] Investigate the foo"
我想要做的就是爲了這些字符串按字母順序基於字符串,而忽略了廣場上的值括號。所以我想最終的結果是:
"[SPIKE] Investigate the foo"
"Project 4"
"[Continued] [Continued] Project task 1"
"[Continued] [Unfinished] Project task 1"
"[Unfinished] Project task 1"
"Project Task 2"
"Random other work to do"
"Some other Piece of work to do"
問:
怎麼能這樣在LINQ來實現,這是我必須:
collection.OrderBy(str => str)
奇妙的是,這正是我所需要的。一旦足夠的時間過去,我會接受這個答案。 –