Hashtable.Keys Property is used to get an
ICollection containing the keys in the
Hashtable.
Syntax:
public virtual System.Collections.ICollection Keys { get; }
Return Value: This property returns an ICollection containing the keys in the Hashtable.
Note:
- The order of keys in the ICollection is unspecified.
- Retrieving the value of this property is an O(1) operation.
Below programs illustrate the use of above-discussed property:
Example 1:
Output:
5: Odd and Prime
9: Odd
2: Even and Prime
4: Even
Example 2: