Access managed C++ public enum class from C# by Dynamically loading
I have an managed C++ dll lib. It has claas info like below
namespace tests
{
public enum class clours
{
Start = 0;
Red = 1;
Green = 2;
Blue = 3;
End = 4;
}
}
I have written a client application in C# and load the dll dynamically(I am using reflection). I want to access the enum members and values between 'Start' and 'End' from the client application.
Re: Access managed C++ public enum class from C# by Dynamically loading
Quote:
Originally Posted by
mjvalan
I have written a client application in C# and load the dll dynamically(I am using reflection). I want to access the enum members and values between 'Start' and 'End' from the client application.
The enumeration seems well defined. You should be able to access it from your C# application. Are facing any problem in particular?
Re: Access managed C++ public enum class from C# by Dynamically loading
Multiple issues I see...
1) public enum class clours - can't have class and enum on the same declaration
2) You need to use commas to separate each enum index, not semicolons.
ie:
Code:
namespace Tests
{
enum Colors
{
Start,
Red,
Green,
Blue,
End,
}
}
Re: Access managed C++ public enum class from C# by Dynamically loading
Good spot mariocatch! I didn't notice that at all. I wonder if mjvalan typed it directly in codeguru...