Mono Class Library: System.Runtime.InteropServices.DllImportAttribute Overview | Members

System.Runtime.InteropServices.DllImportAttribute.CharSet Field

A System.Runtime.InteropServices.CharSet value that controls function name modification and indicates how the string arguments to the method will be marshaled.

public CharSet CharSet

Remarks

This field is set to one of the System.Runtime.InteropServices.CharSet values to indicate the required modifications to the name of the imported function and to the string arguments of the function. The default value for DllImportAttribute.CharSet is CharSet.Ansi.

If DllImportAttribute.CharSet is set to CharSet.Unicode, all string arguments are converted to Unicode characters before being passed to the unmanaged implementation. If the field is set to CharSet.Ansi the string characters are converted to ANSI characters. If DllImportAttribute.CharSet is set to CharSet.Auto, the string and function name conversion is platform dependent.

The DllImportAttribute.CharSet field might also be used to determine which version of a function is imported from the specified shared library by modifying the provided name of the function. The name modification is platform specific, and includes additional characters to indicate the character set.

The default value of this field is CharSet.Ansi.

Requirements

Namespace: System.Runtime.InteropServices
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0