Show / Hide Table of Contents

Class IEnumerableExtensions

IEnumerable<T> extension methods.

Inheritance
object
IEnumerableExtensions
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: GlitchedPolygons.ExtensionMethods
Assembly: GlitchedPolygons.ExtensionMethods.dll
Syntax
public static class IEnumerableExtensions

Fields

| Improve this Doc View Source

StringBuilderInitialCap

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 Source

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 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
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.

| Improve this Doc View Source

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 strings to convert.

Returns
Type Description
string

The comma-separated string containing the input strings (e.g. "element1,element2,element3").

| Improve this Doc View Source

ToCustomCharSeparatedString(IEnumerable<string>, char)

Converts a collection of strings to a single, custom-character-separated string.

Make ABSOLUTELY sure that none of the strings 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 strings to convert.

char separatorChar

The char that will separate one entry from the other in the output string. Could be '|', '+' or something like that, just ensure that it is unique (no string inside the collection should contain the separator char!!!).

Returns
Type Description
string

The flattened string, where each string is separated by separatorChar from one another.

Exceptions
Type Condition
ArgumentException

Thrown when one or more strings inside the strings input collection contains the separatorChar character.

  • Improve this Doc
  • View Source
Back to top Generated by DocFX