+ 7
The type HashSet could not be found
in Visual Studio 2013 I typed this program: using System; using System.Collections.Generic; using System.Text; namespace ConsoleApplication5 { class Program { static void Main(string[] args) { HashSet<int> hs = new HashSet<int>(); for (int x=1; x<=5; x++){ hs.Add(x); } Console.Write(hs.Count); } } } but it can not run in VS and error is The type HashSet could not be found. while it can be run in SoloLearn platform. How Can I solve this on my VisualStudio?
3 Answers
+ 2
What is the .net framework you target.
HashSet only starts from .net framework 3.5.
You can find it in the menu -> project -> ConsoleApplication5 Properties
+ 5
Thanks. I find out that the target framework was on .net 3 . I set that on .net framework 3.5 and it works
+ 1
Well done.