473,386 Members | 1,699 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Reach managed c++ Enum from C#

I'm trying to use an enum created in Managed c++ in a C# project. I can reach
the enums name, i.e.

namespace MyNS
{
public enum MyEnum
{
EOne,
ETwo
};
}

in C++ makes me able to reach MyNS, but not MyNS.EOne. Why?
Mar 6 '07 #1
3 2374
Presumably you need to use MyNS.MyEnum.EOne. In using enum values you need
to use <enum_type_name>.<valueand can't access <valuedirectly.

"Joachim" <Jo*****@discussions.microsoft.comwrote in message
news:92**********************************@microsof t.com...
I'm trying to use an enum created in Managed c++ in a C# project. I can
reach
the enums name, i.e.

namespace MyNS
{
public enum MyEnum
{
EOne,
ETwo
};
}

in C++ makes me able to reach MyNS, but not MyNS.EOne. Why?

Mar 6 '07 #2
Thank you Clive,

However, I have tried that too and it doesn't work.

Regards,
Joachim
"Clive Dixon" wrote:
Presumably you need to use MyNS.MyEnum.EOne. In using enum values you need
to use <enum_type_name>.<valueand can't access <valuedirectly.

"Joachim" <Jo*****@discussions.microsoft.comwrote in message
news:92**********************************@microsof t.com...
I'm trying to use an enum created in Managed c++ in a C# project. I can
reach
the enums name, i.e.

namespace MyNS
{
public enum MyEnum
{
EOne,
ETwo
};
}

in C++ makes me able to reach MyNS, but not MyNS.EOne. Why?


Mar 7 '07 #3
"Joachim" <Jo*****@discussions.microsoft.comwrote in message
news:92**********************************@microsof t.com...
I'm trying to use an enum created in Managed c++ in a C# project. I can reach
the enums name, i.e.

namespace MyNS
{
public enum MyEnum
{
EOne,
ETwo
};
}

in C++ makes me able to reach MyNS, but not MyNS.EOne. Why?

Because you have declared a *native* enum. You'll have to declare a managed enum to be
usable in other managed code.
Try this:
public enum class MyEnum
or..
public enum struct MyEnum

Willy.

Mar 7 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: sach | last post by:
Hi, I get this error error C3181: invalid operand for __typeof, expected a fully defined managed type Whenever I try to use Enum in VC++ .NET, which is actually defined in my VC++ library...
5
by: Alan Cobb | last post by:
Hi, In the managed C++ class below I get compile warning C4677 from VS2003. "signature of non-private function contains assembly private type", even though the managed enum is public. I have...
1
by: Bae,Hyun-jik | last post by:
Is there any way to port legacy C++ enum to managed object? For example, let's assume there is a C++ header file(we cannot modify it, because it is updated by other vendor). It has a enum...
3
by: Tommy Svensson \(InfoGrafix\) | last post by:
I've been instructed to work againt a huge unmanaged C++ API from a C# application. Now, the only way, as I've understood it, is to go the Managed Extensions for C++ way. This means I have to...
0
by: Ewart MacLucas | last post by:
generated some WMI managed classes using the downloadable extensions for vs2003 from mircrosoft downloads; wrote some test code to enumerate the physicall processors and it works a treat, but a...
3
by: Cmtk Software | last post by:
I'm trying to define an enum which will be used from unmanaged c++, C++/CLI managed c++ and from C#. I defined the following enum in a VS dll project set to be compiled with the /clr switch: ...
1
by: =?Utf-8?B?Sm9hY2hpbQ==?= | last post by:
I'm trying to use an enum created in Managed c++ in a C# project. I can reach the enums name, i.e. namespace MyNS { public enum MyEnum { EOne, ETwo };
11
by: briankirkpatrick | last post by:
Forgive me if my post seems a little amateurish... I'm requesting assistance from some of you smart folks out there to get the managed calls write that meet the specification in the esa.h for...
3
by: Dean Mitchell | last post by:
Hi everyone, We have a c++ server application that we are writing a GUI client application for. To save our time and to avoid duplicating all the code and functionality that already exists in...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.