Class IEnumerableExtensions
IEnumerable<T> extension methods.
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 StringBuilder.
Try to give a rough estimate of your output string's length here.Declaration
public static int StringBuilderInitialCap
Field Value
Type | Description |
---|---|
int |
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 afloat
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 |
---|---|---|
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 string
s 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 string
s to a single, custom-character-separated string
.
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 |
---|---|---|
IEnumerable<string> | strings | The collection of |
char | separatorChar | The |
Returns
Type | Description |
---|---|
string | The flattened |
Exceptions
Type | Condition |
---|---|
ArgumentException | Thrown when one or more |