![Collapse image](collapse_all.gif)
![Expand Image](expand_all.gif)
![CollapseAll image](collall.gif)
![ExpandAll image](expall.gif)
![DropDown image](drpdown.gif)
![DropDownHover image](drpdown_orange.gif)
![Copy image](copycode.gif)
![CopyHover image](copycodeHighlight.gif)
[This topic is pre-release documentation and is subject to change in future releases. Blank topics are included as placeholders.]
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: Wintellect.PowerCollections
Assembly:
PowerCollections (in PowerCollections.dll)
Syntax
C# |
---|
public bool TryGetItem( T item, out T foundItem ) |
Visual Basic (Declaration) |
---|
Public Function TryGetItem ( _ item As T, _ <OutAttribute> ByRef foundItem As T _ ) As Boolean |
Visual C++ |
---|
public: bool TryGetItem ( T item, [OutAttribute] T% foundItem ) |
Parameters
- item
- T
The item to search for.
- foundItem
- T%
Returns the item from the set that was equal to item.
Return Value
True if the set contains item. False if the set does not contain item.
Remarks
Searching the set for an item takes approximately constant time, regardless of the number of items in the set.
Examples
In the following example, the set contains strings which are compared in a case-insensitive manner.
![]() | |
---|---|
Set<string> set = new Set<string>(StringComparer.CurrentCultureIgnoreCase); set.Add("HELLO"); string s; bool b = set.TryGetItem("Hello", out s); // b receives true, s receives "HELLO". |
See Also
Set<(Of <T>)> Class
Wintellect.PowerCollections Namespace