I have this method:
public static HashSet<myclass> mymethod(int somenum)
{
myclass[,] myarray = new myclass[somenum, somenum];
// process myarray here
return new HashSet<myclass>(myarray);
}
but on the last line, I get two errors:
Error 1 The best overloaded method match for 'System.Collections.Generic.HashSet.HashSet(System.Collections.Generic.IEnumerable)' has some invalid arguments
Error 2 Argument 1: cannot convert from 'myclass[,]' to 'System.Collections.Generic.IEnumerable'
but according to MSDN, arrays implement IEnumerable
and IEnumerable<T>
. So why am I getting this error, and how can I fix it?