MaskedTextProvider.Set 方法
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
将带格式的字符串设置为指定的输入字符串。
Set(String) |
将带格式的字符串设置为指定的输入字符串。 |
Set(String, Int32, MaskedTextResultHint) |
将带格式的字符串设置为指定的输入字符串,然后输出移除位置和描述性信息。 |
- Source:
- MaskedTextProvider.cs
- Source:
- MaskedTextProvider.cs
- Source:
- MaskedTextProvider.cs
将带格式的字符串设置为指定的输入字符串。
public:
bool Set(System::String ^ input);
public bool Set (string input);
member this.Set : string -> bool
Public Function Set (input As String) As Boolean
参数
返回
如果所有的字符已成功设置,则为 true
;否则为 false
。
例外
input
参数为 null
。
注解
方法 Set 清除格式化字符串的现有内容,然后对 input
字符串应用掩码以更新格式化字符串的内容。
以下条件被视为错误。 发生错误时,格式化的字符串将保持不变,并 Set 返回 false
。
格式化字符串中没有足够的可编辑位置来保存替换字符串的内容。
其中一个替换字符值无效,因为它不可打印或与相应的掩码元素不匹配。
另请参阅
适用于
.NET 9 和其他版本
产品 | 版本 |
---|---|
.NET | Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9 |
.NET Framework | 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET Standard | 2.0, 2.1 |
- Source:
- MaskedTextProvider.cs
- Source:
- MaskedTextProvider.cs
- Source:
- MaskedTextProvider.cs
将带格式的字符串设置为指定的输入字符串,然后输出移除位置和描述性信息。
public:
bool Set(System::String ^ input, [Runtime::InteropServices::Out] int % testPosition, [Runtime::InteropServices::Out] System::ComponentModel::MaskedTextResultHint % resultHint);
public bool Set (string input, out int testPosition, out System.ComponentModel.MaskedTextResultHint resultHint);
member this.Set : string * int * MaskedTextResultHint -> bool
Public Function Set (input As String, ByRef testPosition As Integer, ByRef resultHint As MaskedTextResultHint) As Boolean
参数
- testPosition
- Int32
如果成功,则为带格式字符串中实际设置最后一个字符的位置(从零开始计);否则为该操作第一次失败时所处的位置。 一个输出参数。
- resultHint
- MaskedTextResultHint
一个 MaskedTextResultHint,用于简单地描述设置操作的结果。 一个输出参数。
返回
如果所有的字符已成功设置,则为 true
;否则为 false
。
例外
input
参数为 null
。
注解
方法 Set 清除格式化字符串的现有内容,然后对 input
字符串应用掩码以更新格式化字符串的内容。
以下条件被视为错误。 发生错误时,格式化的字符串将保持不变,并 Set 返回 false
。
格式化字符串中没有足够的可编辑位置来保存替换字符串的内容。
其中一个替换字符值无效,因为它不可打印或与相应的掩码元素不匹配。
此版本的 Set 提供两个附加的输出参数,用于传达有关 方法操作的详细信息。
另请参阅
适用于
.NET 9 和其他版本
产品 | 版本 |
---|---|
.NET | Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9 |
.NET Framework | 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET Standard | 2.0, 2.1 |