I have both visual studio 2017 and 2012. My project that I'm creating working only with VS2012 (I really don't know why, there are some additional installations that can be installed only on VS2012).
Here is part of my code. For example:
enum Colors
{
blue = 0,
green = 1,
red = 2,
}
public Class LED
{
private ComponentLED[] _arr;
public LED()
{
//Here I create the array and fill him with the objects.
}
private ComponentLED GetLEDObjectByColor(string color)
{
//This line don't work
//('System.Enum' does not contain a definition for 'Parse'
int index = (int)( (Colors)Enum.Parse(typeof(Colors), color) );
return _arr[index];
}
}
From what I understood: System.dll don't define some functions. The only functions I see that works on Enum class are: Enum.Equals Enum.ReferenceEquals
So I thought the problem may be in the system.dll it's self.
Maybe you know what is the problem or how to solve it. I would very appreciate you.
Here some information about my current system.dll
Path: C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.2\Assemblies\le\System.dll
Runtime Version: v4.0.30319
Version: 4.2.0.0
and Application information: Target Framework: .Net Micro FrameWork 4.2 (It's most - can't change it)
The .NET MicroFramework is a very, very slimmed down version of the .NET framework that can run on embedded systems. In order to fit in the tight memory limits for these systems, a lot of features of the .NET base library have been stripped to leave the most important ones only. The correct .NET MicroFramework system library guidance for enums can be found here. And you'll see that it doesn't contain any Parse options.
In the case of your Color enum parsing, you'll probably have to implement your own code to do so based on the underlying int values. That will also make it much faster on these limited systems.
The .NET MicroFramework development slowed down considerably in the past years, but recently a new team has picked up development for it and ported it to Visual Studio 2017. A nice intro can be found on Channel9 and the code to build against 2017 can be tracked in this GitHub issue.