The problem is that you need to provide a lambda expression for the second argument of ToDictionary. ToDictionary also returns a Dictionary<T, U> so you won’t be able to assign it to an instance of ConcurrentDictionary<T, U>.
This should do the trick:
var dicFailedProxies =
File.ReadLines("failed_proxies.txt")
.Distinct()
.ToDictionary(line => line, line => 0);
Of course, if you want to keep it as a ConcurrentDictionary<T, U> you can do this:
var dicFailedProxies = new ConcurrentDictionary<string, int>(
File.ReadLines("failed_proxies.txt")
.Distinct()
.ToDictionary(line => line, line => 0));
6
solved How to read lines to dictionary with linQ [closed]