This topic has not yet been rated - Rate this topic

MaskedTextProvider.ToString Method (Boolean, Boolean, Boolean, Int32, Int32)

Returns a substring of the formatted string, optionally including prompt, literal, and password characters.

Namespace:  System.ComponentModel
Assembly:  System (in System.dll)
public string ToString(
	bool ignorePasswordChar,
	bool includePrompt,
	bool includeLiterals,
	int startPosition,
	int length
)

Parameters

ignorePasswordChar
Type: System.Boolean

true to return the actual editable characters; otherwise, false to indicate that the PasswordChar property is to be honored.

includePrompt
Type: System.Boolean

true to include prompt characters in the return string; otherwise, false.

includeLiterals
Type: System.Boolean

true to return literal characters in the return string; otherwise, false.

startPosition
Type: System.Int32

The zero-based position in the formatted string where the output begins.

length
Type: System.Int32

The number of characters to return.

Return Value

Type: System.String
If successful, a substring of the formatted String, which includes all the assigned character values and optionally includes literals, prompts, and password characters; otherwise the Empty string.

This version of the overloaded ToString method returns a substring of the formatted string, starting at the position startPos and including the subsequent number of characters specified by the length parameter. The return string includes prompts and literals according to the values of the IncludePrompt and IncludeLiterals parameters, respectively. Notice that these parameters override the values of the IncludePrompt and IncludeLiterals properties. If the ignorePasswordChar parameter is true, it will return the original input characters, ignoring the value of the PasswordChar property. If this parameter is false, it will use the password character to obscure editable user input if the PasswordChar property is set to a value other than null.

Important noteImportant

Because this method potentially reveals information that is usually protected in the user interface by password characters, it should be used with extreme caution to avoid accidentally revealing sensitive user data.

ToString performs the following actions when there are discrepancies in the input parameters:

  • If startPos is less than zero, the starting position is set to zero.

  • If startPos is greater than or equal to the actual Length of the formatted string, the Empty string is returned.

  • If length is greater than the remaining number of characters past the starting position, only the remaining characters are returned.

  • If length is less than or equal to zero, the Empty string is returned.

.NET Framework

Supported in: 4.5.1, 4.5, 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows Phone 8.1, Windows Phone 8, Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.