-
January 25th, 2010, 05:00 AM
#1
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.
-
January 25th, 2010, 06:22 AM
#2
Re: Access managed C++ public enum class from C# by Dynamically loading
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?
-
January 25th, 2010, 01:19 PM
#3
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,
}
}
-
January 25th, 2010, 06:21 PM
#4
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...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|