I want to implement a Mongoose (http://code.google.com/p/mongoose/) Binding in C#. There are some examples, but they don\'t work with the current version.
This is my cu
In C# a char is an Unicode character, therefore consisting of two bytes. Using strings is not an option here, but you can use the Encoding.ASCII class to get the ASCII representation of the unicode string as a byte array:
byte[] asciiString = Encoding.ASCII.GetBytes(unicodeString);
C#'s arrays are references, aka pointers in C, so you can write your code as:
byte[][] options = {
Encoding.ASCII.GetBytes("document_root"),
Encoding.ASCII.GetBytes("/var/www"),
Encoding.ASCII.GetBytes("listening_ports"),
Encoding.ASCII.GetBytes("80,443s"),
null
};
You can't do anything about the const other than creating a wrapper class with read-only indexers and a private array of bytes, but this won't work in your case.