Distinct function on a list does not change the list

Viewed 31

Why is the distinct function not working? Every other function works when I use it this way (I really mean every other - Sort changes list, OrderBy does not; AddRange changes list, Concat does not - very confusing).

using System;
using System.Collections.Generic;
using System.Linq;

namespace ConsoleApp6
{
    class Program
    {
        static void Main(string[] args)
        {
            string text = Console.ReadLine();
            List<string> infos = text.Split(" ").ToList();
            infos.Distinct();
            foreach (string info in infos)
            {
                Console.Write(info + " ");
            }
        }
    }
}

0 Answers
Related