G
Guest
Hello, Newsgroupians:
Just a quick question really quick. Does C# have a generic class that will
allow me to add only one instance of an object to the "collection" without
having me do a .Contains() or something similar?
In my case, I have a set of controls a user selects. If the user selects
the same control twice, I don't want it added again to my collection, and I
don't want to handle the exception, and I think .Contains() is too expensive.
Does anyone have any recommendations? I've tried a Dictionary with the key
being the control as well as the value being the control, but again doing
this led to an exception. Is there any other way or generic class that I
should look at?
Thank you.
Trecius
Just a quick question really quick. Does C# have a generic class that will
allow me to add only one instance of an object to the "collection" without
having me do a .Contains() or something similar?
In my case, I have a set of controls a user selects. If the user selects
the same control twice, I don't want it added again to my collection, and I
don't want to handle the exception, and I think .Contains() is too expensive.
Does anyone have any recommendations? I've tried a Dictionary with the key
being the control as well as the value being the control, but again doing
this led to an exception. Is there any other way or generic class that I
should look at?
Thank you.
Trecius