Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ ToDictionary< TSource, TKey >() [2/2]

static Dictionary< TKey, TSource > System.Linq.ParallelEnumerable.ToDictionary< TSource, TKey > ( this ParallelQuery< TSource > source,
Func< TSource, TKey > keySelector,
IEqualityComparer< TKey >? comparer )
inlinestatic
Type Constraints
TKey :notnull 

Definition at line 1776 of file ParallelEnumerable.cs.

1776 : notnull
1777 {
1778 if (source == null)
1779 {
1780 throw new ArgumentNullException("source");
1781 }
1782 if (keySelector == null)
1783 {
1784 throw new ArgumentNullException("keySelector");
1785 }
1788 using (enumerator)
1789 {
1790 while (enumerator.MoveNext())
1791 {
1792 TSource current = enumerator.Current;
1793 try
1794 {
1795 TKey key = keySelector(current);
1796 dictionary.Add(key, current);
1797 }
1798 catch (Exception ex)
1799 {
1800 throw new AggregateException(ex);
1801 }
1802 }
1803 return dictionary;
1804 }
1805 }

References System.comparer, System.dictionary, System.Collections.Generic.Dictionary< TKey, TValue >.GetEnumerator(), System.key, System.Linq.keySelector, and System.Linq.source.