Click or drag to resize
OrderedSetTTryGetItem Method

Determines if this set contains an item equal to item, according to the comparison mechanism that was used when the set was created. The set is not changed.

If the set does contain an item equal to item, then the item from the set is returned.

Namespace: X3Platform.Collections
Assembly: X3Platform.Support (in X3Platform.Support.dll) Version: 1.0.0.0 (2.0.0.0)
Syntax
public bool TryGetItem(
	T item,
	out T foundItem
)

Parameters

item
Type: T
The item to search for.
foundItem
Type: T
Returns the item from the set that was equal to item.

Return Value

Type: Boolean
True if the set contains item. False if the set does not contain item.
Remarks
Searching the set for an item takes time O(log N), where N is the number of items in the set.
Examples
In the following example, the set contains strings which are compared in a case-insensitive manner.
OrderedSet<string> set = new OrderedSet<string>(StringComparer.CurrentCultureIgnoreCase);
set.Add("HELLO");
string s;
bool b = set.TryGetItem("Hello", out s);   // b receives true, s receives "HELLO".
See Also