I’m looking for a C# generic container that it’s a List<T>, but no repeated elements allowed.
In another word, it’s a Set<T>, but can also be accessed via [index] operator.
Thanks.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
As suggested in the comments, you could implement
IList<T>that delegates to an innerList<T>instance, and guards add and remove calls with using aHashSet<T>:I didn’t compile this code, but you get the idea…