EnumerableExtensionsToStringKeyedDictionaryTValue(IEnumerableTValue, FuncTValue, String, StringSegmentComparer) Method

Creates a StringKeyedDictionaryTValue from an IEnumerableT instance using the specified keySelector delegate and a comparer.

Definition

Namespace: KGySoft.CoreLibraries
Assembly: KGySoft.CoreLibraries (in KGySoft.CoreLibraries.dll) Version: 9.0.0
C#
public static StringKeyedDictionary<TValue> ToStringKeyedDictionary<TValue>(
	this IEnumerable<TValue> source,
	Func<TValue, string> keySelector,
	StringSegmentComparer? comparer = null
)

Parameters

source  IEnumerableTValue
The source collection to create a StringKeyedDictionaryTValue from.
keySelector  FuncTValue, String
A delegate to produce a key for each element in the source collection.
comparer  StringSegmentComparer  (Optional)
A StringSegmentComparer to compare keys. If , then ordinal comparison will be used. This parameter is optional.
Default value: .

Type Parameters

TValue
The type of the elements in the source collection and the type of the values in the returned StringKeyedDictionaryTValue.

Return Value

StringKeyedDictionaryTValue
A StringKeyedDictionaryTValue that contains the same values that are in source associated with keys returned created by the specified keySelector.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IEnumerableTValue. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

See Also