Language Conversion

Parent Previous

Language Conversion.

If the presented C# source code is to be converted into another programming language, then there are a few things to consider.


String Encoding.

The Unicode.CodePage is used everywhere because it matches the C# internal string type. Other programming languages may use UTF-8 or another string type, in which case the codepage should match that.


Pointer to Byte-Array.

Whenever an API function contains a parameter of the type pointer to byte-array, we use the C# type byte[] to define the argument type.


This may not work in your programming language if the address of a byte-array is not the address of the first byte in the byte-array, in which case you should consider passing the address of the first byte instead.


It is also imperative that a byte-array is simply an allocated block of bytes in sequential order. Some programming languages provide array classes with internal pointers for more advanced/flexible functionality, in which case you should perhaps look for alternatives - occasionally referred to as creating a buffer of bytes or to pack data into a binary.