Tries to get an item from the collection using the specified key.
            
            
            Syntax
            
            
            
            
            'Declaration
 
Function TryGetValue( _
   ByVal  As , _
   ByRef  As  _
) As Boolean
             
        
            
            'Usage
 
Dim instance As IKeyedCollection(Of TKey,TItem)
Dim key As 
Dim item As 
Dim value As Boolean
 
value = instance.TryGetValue(key, item)
             
        
            
            bool TryGetValue( 
    ,
   out  
)
             
        
            
            bool TryGetValue( 
    ,
   [Out]  
) 
             
        
             
        
            Parameters
- key
- The key of the item to search in the collection.
The value of this parameter cannot be null(Nothingin Visual Basic).
 
- item
- When this method returns true, the item from the collection that matches the provided key; when this method returnsfalse, thedefaultvalue for the type of the collection.The value of this parameter can be null(Nothingin Visual Basic).
 
Return Value
true if an item for the specified key was found in the collection; otherwise, false.
 
            Exceptions
| Exception | Description | 
|---|
| System.ArgumentNullException | 
            A nullreference (Nothingin Visual Basic) is passed to a method that does not accept it as a valid argument. 
            This is a usage error, i.e. it will never occur (the exception will not be thrown) in a correctly written program. Your code should not catch this exception. | 
Requirements
 
Target Platforms: .NET Framework: Windows 10 (selected versions), Windows 11 (selected versions), Windows Server 2016, Windows Server 2022; .NET: Linux, macOS, Microsoft Windows
            
            See Also