“Better” is arguable, but you could use the built-in method UnionWith
and some LINQ for a nice one liner to replace your foreach. Think of it as the closest equivalent to an AddRange, except with the restrictions of a set of course.
values.Clear();
values.UnionWith(_values.Select(x => x.Trim()));
2
solved Trim HashSet