Table of Contents

Class XEnumerable

Extension methods for IEnumerable and IEnumerable{T}.

Inheritance
System.Object
XEnumerable
Namespace: Galaxon.Core.Collections
Assembly: Galaxon.Core.dll
Syntax
public static class XEnumerable : object

Methods

Diff<T>(IEnumerable<T>, IEnumerable<T>)

Return list1 with values from list2 removed. Supports duplicates, so this is not the same as set difference. For example, if list1 has two instances of "cat" and list2 has one instance of "cat", the result will have one instance of "cat".

Declaration
public static IEnumerable<T> Diff<T>(this IEnumerable<T> list1, IEnumerable<T> list2)
Parameters
Type Name Description
IEnumerable<T> list1
IEnumerable<T> list2
Returns
Type Description
IEnumerable<T>
Type Parameters
Name Description
T
| Improve this Doc View Source

ToDictionary<T>(IEnumerable<T>)

Convert an IEnumerable{T} into a dictionary with the dictionary's keys set to zero-based index, same as an array or list. This can be useful when the index is meaningful and you want to filter on it.

Declaration
public static Dictionary<int, T> ToDictionary<T>(this IEnumerable<T> enumerable)
Parameters
Type Name Description
IEnumerable<T> enumerable
Returns
Type Description
Dictionary<System.Int32, T>
Type Parameters
Name Description
T
| Improve this Doc View Source
  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX | Galaxy logo by Freepik