CharSet Field
Collapse the table of content
Expand the table of content

DllImportAttribute.CharSet Field

Indicates how to marshal string parameters to the method and controls name mangling.

[Visual Basic]
Public CharSet As CharSet
public CharSet CharSet;
public: CharSet CharSet;
public var CharSet : CharSet;


Use this field with a member of the CharSet enumeration to specify the marshaling behavior of string parameters and to specify which entry-point name to invoke (the exact name given or a name ending with "A" or "W"). The default enumeration member for C# and Visual Basic is CharSet.Ansi and the default enumeration member for C++ is CharSet.None, which is equivalent to CharSet.Ansi. In Visual Basic, you use the Declare statement to specify the CharSet field.

The ExactSpelling field influences the behavior of the CharSet field in determining which entry-point name to invoke. For a detailed description and examples of the string marshaling and name matching behavior associated with the CharSet field, see Specifying a Character Set.


Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework, Common Language Infrastructure (CLI) Standard

See Also

DllImportAttribute Class | DllImportAttribute Members | System.Runtime.InteropServices Namespace | ExactSpelling

© 2016 Microsoft