Class IEnumerableExtensions
IEnumerable<T> extension methods.
Inherited Members
Namespace: GlitchedPolygons.ExtensionMethods
Assembly: GlitchedPolygons.ExtensionMethods.dll
Syntax
public static class IEnumerableExtensions
Fields
StringBuilderInitialCap
The initial capacity of the internal <xref href="System.Text.StringBuilder" data-throw-if-not-resolved="false"></xref>.
Try to give a rough estimate of your output string's length here.
Declaration
public static int StringBuilderInitialCap
Field Value
| Type | Description |
|---|---|
| int |
Methods
Compare<T>(IEnumerable<T>, IEnumerable<T>)
Compares two collections and returns a score.
Ideally, you'd set a carefully selected threshold of equality (such as 0.75f), but NOT 100%.
The resulting equality score is a <code>float</code> value between [0;1] where <code>0</code> is completely different and <code>1</code> entirely identical.
Duplicate values are stripped from both collections before comparison.
Declaration
public static float Compare<T>(this IEnumerable<T> collection1, IEnumerable<T> collection2)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<T> | collection1 | Collection 1 |
| IEnumerable<T> | collection2 | Collection 2 |
Returns
| Type | Description |
|---|---|
| float | The resulting equality score: a value between [0;1] where 0 is completely different and 1 entirely identical. |
Type Parameters
| Name | Description |
|---|---|
| T | ICollection<T> type parameter. |
ToCommaSeparatedString(IEnumerable<string>)
Converts a collection of strings to a single, comma-separated string.
Declaration
public static string ToCommaSeparatedString(this IEnumerable<string> e)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<string> | e | The collection of |
Returns
| Type | Description |
|---|---|
| string | The comma-separated |
ToCustomCharSeparatedString(IEnumerable<string>, char)
Converts a collection of <code>string</code>s to a single, custom-character-separated <code>string</code>.
Make ABSOLUTELY sure that none of the <code>string</code>s in the collection contains the <code class="paramref">separatorChar</code>!!
It would mess with the reverse method (which is <code>string.Split(<code class="paramref">separatorChar</code>)</code>)
Declaration
public static string ToCustomCharSeparatedString(this IEnumerable<string> strings, char separatorChar)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<string> | strings | The collection of |
| char | separatorChar | The |
Returns
| Type | Description |
|---|---|
| string | The flattened |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException | Thrown when one or more |