Windows apps
Collapse the table of content
Expand the table of content
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

BestFitMappingAttribute.BestFitMapping Property


The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

Gets the best-fit mapping behavior when converting Unicode characters to ANSI characters.

Namespace:   System.Runtime.InteropServices
Assembly:  mscorlib (in mscorlib.dll)

public bool BestFitMapping { get; }

Property Value

Type: System.Boolean

true if best-fit mapping is enabled; otherwise, false. The default is true.

If best-fit mapping is false and ThrowOnUnmappableChar is true, all Unicode characters that require conversion to ANSI format will generate an exception when passed to unmanaged code. Some characters are unmappable, even when best-fit mapping is true. Some characters lack a best-fit representation; these characters are called unmappable. Unmappable characters are usually converted to the default '?' ANSI character.


Certain Unicode characters are converted to dangerous characters, such as the backslash '\' character, which can inadvertently change a path.

Universal Windows Platform
Available since 8
.NET Framework
Available since 1.1
Portable Class Library
Supported in: portable .NET platforms
Windows Phone
Available since 8.1
Return to top
© 2018 Microsoft