remove duplicate words from string in C#

前端 未结 4 553
猫巷女王i
猫巷女王i 2020-12-19 20:05

here is my code:

class Program
    {
        static void Main(string[] args)
        {
            string sentence = string.Empty;
            sentence = Con         


        
4条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-19 20:35

    Use Distinct:

    foreach (string s in x.Distinct())
    {
            Console.WriteLine(s.ToLower());
    }
    

提交回复
热议问题