I downloaded a library that uses the generic version of SortedList, but when I try to compile it the following error pops up:
The type or namespace name 'SortedList' does not exist in the namespace 'System.Collections.Generic' (are you missing an assembly reference?)
I tried to fix it using the full namespace, System.Collections.Generic.SortedList<string, string> but still no luck, the same error.
I looked up in MSDN and it says that SortedList is supported on .NET 4.0 (the version I am currently using).
Also, my projects references the mentioned namespaces.
This is the code (the error gets repeated more than once, for every reference to SortedList):
public class Map
{
public SortedList<string, Tileset> Tilesets = new SortedList<string, Tileset>();
public SortedList<string, Layer> Layers = new SortedList<string, Layer>();
public SortedList<string, ObjectGroup> ObjectGroups = new SortedList<string, ObjectGroup>();
public SortedList<string, string> Properties = new SortedList<string, string>();
public int Width, Height;
public int TileWidth, TileHeight;
}
Right-click on your project's References and select "Add Reference". Select "Assemblies", and put a tick next to "System". Click on "OK" and it should now be fixed.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With