A
A
Avery0072014-08-12 16:42:14
C++ / C#
Avery007, 2014-08-12 16:42:14

How to pass enum to unmanaged code?

You need to pass enum to unmanaged code.
In native code itself, they are defined as:

typedef enum1
{
      a  = 1,
      b = 2
} First;
typedef enum2
{
      a
      b
} Second;

How to define them in C# and pass them when called?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Mikhail Zakharov, 2014-08-12
@Avery007

Easy to define

public enum First
{
a = 1,
b = 2
}

And pass the First value to the desired function. Should work.
Sources:
social.msdn.microsoft.com/forums/vstudio/en-US/d91...
stackoverflow.com/questions/148856/using-p-invoke-...
bytes.com/topic/c-sharp/answers /591023-passing-enu...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question