Class IEnumerableExtensions
IEnumerable<T> extension methods.
Inheritance
Inherited Members
Namespace: GlitchedPolygons.ExtensionMethods
Assembly: GlitchedPolygons.ExtensionMethods.dll
Syntax
public static class IEnumerableExtensions
Fields
| Improve this Doc View SourceStringBuilderInitialCap
The initial capacity of the internal System.Text.StringBuilder.
Try to give a rough estimate of your output string's length here.
Declaration
public static int StringBuilderInitialCap
Field Value
Type | Description |
---|---|
System.Int32 |
Methods
| Improve this Doc View SourceCompare<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
float
value between [0;1] where 0
is completely different and 1
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 |
---|---|---|
System.Collections.Generic.IEnumerable<T> | collection1 | Collection 1 |
System.Collections.Generic.IEnumerable<T> | collection2 | Collection 2 |
Returns
Type | Description |
---|---|
System.Single | The resulting equality score: a value between [0;1] where 0 is completely different and 1 entirely identical. |
Type Parameters
Name | Description |
---|---|
T | System.Collections.Generic.ICollection<T> type parameter. |
ToCommaSeparatedString(IEnumerable<String>)
Converts a collection of string
s to a single, comma-separated string
.
Declaration
public static string ToCommaSeparatedString(this IEnumerable<string> e)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<System.String> | e | The collection of |
Returns
Type | Description |
---|---|
System.String | The comma-separated |
ToCustomCharSeparatedString(IEnumerable<String>, Char)
Converts a collection of string
s to a single, custom-character-separated string
.
Make ABSOLUTELY sure that none of the
string
s in the collection contains the separatorChar
!!It would mess with the reverse method (which is
string.Split(separatorChar
)
)
Declaration
public static string ToCustomCharSeparatedString(this IEnumerable<string> strings, char separatorChar)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<System.String> | strings | The collection of |
System.Char | separatorChar | The |
Returns
Type | Description |
---|---|
System.String | The flattened |
Exceptions
Type | Condition |
---|---|
System.ArgumentException | Thrown when one or more |