Table of Contents

Class ExtensionMethods

Namespace
Ranorex.Core
Assembly
Ranorex.Core.dll

Provides common "extension" methods that are available in higher .NET Frameworks but not in the 2.0 Framework.

public static class ExtensionMethods
Inheritance
ExtensionMethods
Inherited Members

Methods

AddRange<T>(ICollection<T>, IEnumerable<T>)

Adds the items of the specified enumerable to the end of the collection.

public static void AddRange<T>(ICollection<T> collection, IEnumerable<T> items)

Parameters

collection ICollection<T>

An ICollection<T> instance.

items IEnumerable<T>

The items to add to the collection.

Type Parameters

T

The type of the items in the collection.

Exceptions

ArgumentNullException

collection or items is a null reference.

ConvertAll<T, TOutput>(IEnumerable<T>, Converter<T, TOutput>)

Converts the items returned by enumerable to another type, and returns a list containing the converted elements.

public static List<TOutput> ConvertAll<T, TOutput>(IEnumerable<T> enumerable, Converter<T, TOutput> converter)

Parameters

enumerable IEnumerable<T>

An IEnumerable<T> instance.

converter Converter<T, TOutput>

A delegate that converts each element to another type.

Returns

List<TOutput>

A list containing the converted items.

Type Parameters

T

The type of the items returned by enumerable.

TOutput

The type of the converted items in the returned list.

ForEach<T>(IEnumerable<T>, Action<T>)

Performs the specified action on each item returned by enumerable.

public static void ForEach<T>(IEnumerable<T> enumerable, Action<T> action)

Parameters

enumerable IEnumerable<T>

An IEnumerable<T> instance.

action Action<T>

The Action<T> delegate to perform on each item returned by enumerable.

Type Parameters

T

The type of the items returned by enumerable.

Exceptions

ArgumentNullException

enumerable or action is a null reference.

RemoveDuplicates<T, S>(ICollection<T>, MapDelegate<T, S>)

Removes duplicates from a list using the provided identity mapping function.

public static List<T> RemoveDuplicates<T, S>(ICollection<T> srcCollection, ExtensionMethods.MapDelegate<T, S> identFunc)

Parameters

srcCollection ICollection<T>

The collection to remove the duplicates from.

identFunc ExtensionMethods.MapDelegate<T, S>

The identity mapping function to apply to the items in the collection.

Returns

List<T>

A new list containing all elements from the source collection, without duplicates.

Type Parameters

T

The type of the items in the collection.

S

The type of the item identity.

SequenceEqual<T>(IList<T>, IList<T>)

Determines whether two lists are equal by comparing their elements.

public static bool SequenceEqual<T>(IList<T> a, IList<T> b)

Parameters

a IList<T>

The first list.

b IList<T>

The second list.

Returns

bool

True if the two lists contain the same elements in the same order; otherwise false.

Type Parameters

T

The type of the items in the lists.

TrueForAll<T>(IEnumerable<T>, Predicate<T>)

Determines whether every item returned by enumerable matches the conditions defined by the specified predicate.

public static bool TrueForAll<T>(IEnumerable<T> enumerable, Predicate<T> match)

Parameters

enumerable IEnumerable<T>

An IEnumerable<T> instance.

match Predicate<T>

The Predicate<T> delegate that defines the conditions to check against the items.

Returns

bool

true if every item returned by enumerable matches the conditions defined by the specified predicate; otherwise, false. If the enumerable returns no items, the return value is true.

Type Parameters

T

The type of the items returned by enumerable.

Exceptions

ArgumentNullException

enumerable or match is a null reference.