How do I convert an array to a hash set ?
string[] BlockedList = BlockList.Split(new char[] { ';' },
StringSplitOptions.RemoveEmptyEntries);
I need to convert this list to a hashset.
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.
You do not specify what type
BlockedListis, so I will assume it is something that derives fromIList(if meant to sayStringwhere you wroteBlockListthen it would be a string array which derives fromIList).HashSethas a constructor that takes anIEnumerable, so you need merely pass the list into this constructor, asIListderives fromIEnumerable.