I\'ve read this question about why it is not possible, but haven\'t found a solution to the problem.
I would like to retrieve an item from a .NET HashSet
This method has been added to .NET Framework 4.7.2 (and .NET Core 2.0 before it); see HashSet
///
/// Searches the set for a given value and returns the equal value it finds, if any.
///
/// The value to search for.
///
///
/// The value from the set that the search found, or the default value
/// of when the search yielded no match.
/// A value indicating whether the search was successful.
///
/// This can be useful when you want to reuse a previously stored reference instead of
/// a newly constructed one (so that more sharing of references can occur) or to look up
/// a value that has more complete data than the value you currently have, although their
/// comparer functions indicate they are equal.
///
public bool TryGetValue(T equalValue, out T actualValue)