replace .count()==0 with !.any()

This commit is contained in:
solarin 2020-04-03 22:38:20 +04:00
parent 2f67993e93
commit c09fe33167

View file

@ -126,7 +126,7 @@ namespace TLSharp.Core
TLDcOption dc;
if (dcIpVersion != DataCenterIPVersion.Default)
{
if (dcs.Count() == 0)
if (!dcs.Any())
throw new Exception($"Telegram server didn't provide us with any IPAddress that matches your preferences. If you chose OnlyIPvX, try switch to PreferIPvX instead.");
dcs = dcs.OrderBy(d => d.Ipv6);
dc = dcIpVersion == DataCenterIPVersion.PreferIPv4 ? dcs.First() : dcs.Last(); // ipv4 addresses are at the beginning of the list because it was ordered