Click to See Complete Forum and Search --> : Usng header file defines in C# Code


asafaa
June 4th, 2008, 11:41 PM
i need to create a header (*.h) file with these defines :

#define MY_FIRST_DEFINE 1
#define MY_SECOND_DEFINE 2
#define MY_THIRD_DEFINE 3

and use it in a cs file - C# Code.

How do i include it ?
do i need to write a special code in the header file ?
do i need to write a special code in the C# file ?

thanks.

cilu
June 5th, 2008, 01:37 AM
:) That's not going to work. You cannot use C++ files in C#. ;) Simply create a cs file with an enumeration:

public enum Defines
{
MY_FIRST_DEFINE = 1,
MY_SECOND_DEFINE = 2,
MY_THIRD_DEFINE = 3
}

Or you could make it a static class if you want.

public static class Defines
{
public const int MY_FIRST_DEFINE = 1;
public const int MY_SECOND_DEFINE = 2;
public const int MY_THIRD_DEFINE = 3;
}