T
tzvika.visman
I write a MC++ wrapper for our company internal SDK that wrote in C++ native
code for writing application with this SDK over C# and other .NET languages
and most of my SDK API function return a status code that define as a enum
type.
Do I have other option then duplicate the enum from the c++ to the C# code
and write a MC++ class that look something like this:
public __gc class ManagedDokStatus
{
public:
ManagedDokStatus(DOK_STATUS statusCode):m_statusCode (statusCode ){}
__property int get_Status()
{
return static_cast<int> (m_statusCode);
}
private:
DOK_STATUS m_statusCode;
};
The DOK_STATUS type is the native c++ enum and from the C# code I done
something like this:
Declare the following enum:
enum C#DokStatus
{
// define the same c++ native enum attributes
};
And using the API like this:
return (C#DokStatus)(dok.getSerialNumber (ref serialNumber)).Status;
code for writing application with this SDK over C# and other .NET languages
and most of my SDK API function return a status code that define as a enum
type.
Do I have other option then duplicate the enum from the c++ to the C# code
and write a MC++ class that look something like this:
public __gc class ManagedDokStatus
{
public:
ManagedDokStatus(DOK_STATUS statusCode):m_statusCode (statusCode ){}
__property int get_Status()
{
return static_cast<int> (m_statusCode);
}
private:
DOK_STATUS m_statusCode;
};
The DOK_STATUS type is the native c++ enum and from the C# code I done
something like this:
Declare the following enum:
enum C#DokStatus
{
// define the same c++ native enum attributes
};
And using the API like this:
return (C#DokStatus)(dok.getSerialNumber (ref serialNumber)).Status;