TimeOnly.TryParseExact 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
重载
TryParseExact(ReadOnlySpan<Char>, String[], IFormatProvider, DateTimeStyles, TimeOnly)
- Source:
- TimeOnly.cs
- Source:
- TimeOnly.cs
- Source:
- TimeOnly.cs
- Source:
- TimeOnly.cs
- Source:
- TimeOnly.cs
将时间的指定字符范围转换为等效 TimeOnly 字符,并返回一个值,该值指示转换是否成功。
public:
static bool TryParseExact(ReadOnlySpan<char> s, cli::array <System::String ^> ^ formats, IFormatProvider ^ provider, System::Globalization::DateTimeStyles style, [Runtime::InteropServices::Out] TimeOnly % result);
public static bool TryParseExact(ReadOnlySpan<char> s, string?[]? formats, IFormatProvider? provider, System.Globalization.DateTimeStyles style, out TimeOnly result);
static member TryParseExact : ReadOnlySpan<char> * string[] * IFormatProvider * System.Globalization.DateTimeStyles * TimeOnly -> bool
Public Shared Function TryParseExact (s As ReadOnlySpan(Of Char), formats As String(), provider As IFormatProvider, style As DateTimeStyles, ByRef result As TimeOnly) As Boolean
参数
- s
- ReadOnlySpan<Char>
包含分析时间的跨度。
- formats
- String[]
允许格式的 s数组。
- provider
- IFormatProvider
一个对象,提供有关区域性特定的格式设置信息 s。
- style
- DateTimeStyles
枚举值的按位组合,用于定义如何解释分析的时间。 要指定 None的典型值为 。
- result
- TimeOnly
此方法返回时,包含 TimeOnly 与所包含 s时间等效的值(如果转换成功)或 TimeOnly.MinValue (如果转换失败)。 如果 s 为空字符串或不包含时间的有效字符串表示形式,则转换失败。 此参数未初始化传递。
返回
true 如果 s 已成功转换,则为 :否则为 false。
适用于
TryParseExact(ReadOnlySpan<Char>, ReadOnlySpan<Char>, IFormatProvider, DateTimeStyles, TimeOnly)
- Source:
- TimeOnly.cs
- Source:
- TimeOnly.cs
- Source:
- TimeOnly.cs
- Source:
- TimeOnly.cs
- Source:
- TimeOnly.cs
使用指定的格式、区域性特定的格式信息和样式,将时间的指定范围表示形式转换为其 TimeOnly 等效形式。 字符串表示形式的格式必须与指定的格式完全匹配。 该方法返回一个值,该值指示转换是否成功。
public:
static bool TryParseExact(ReadOnlySpan<char> s, ReadOnlySpan<char> format, IFormatProvider ^ provider, System::Globalization::DateTimeStyles style, [Runtime::InteropServices::Out] TimeOnly % result);
public static bool TryParseExact(ReadOnlySpan<char> s, ReadOnlySpan<char> format, IFormatProvider? provider, System.Globalization.DateTimeStyles style, out TimeOnly result);
static member TryParseExact : ReadOnlySpan<char> * ReadOnlySpan<char> * IFormatProvider * System.Globalization.DateTimeStyles * TimeOnly -> bool
Public Shared Function TryParseExact (s As ReadOnlySpan(Of Char), format As ReadOnlySpan(Of Char), provider As IFormatProvider, style As DateTimeStyles, ByRef result As TimeOnly) As Boolean
参数
- s
- ReadOnlySpan<Char>
包含转换时间的跨度。
- format
- ReadOnlySpan<Char>
所需的格式 s。
- provider
- IFormatProvider
一个对象,提供有关区域性特定的格式设置信息 s。
- style
- DateTimeStyles
一个或多个枚举值的按位组合,指示允许的格式 s。
- result
- TimeOnly
此方法返回时,包含 TimeOnly 与所包含 s时间等效的值(如果转换成功)或 TimeOnly.MinValue (如果转换失败)。 如果 s 为空字符串或不包含与格式指定的模式对应的时间,则转换失败。 此参数未初始化传递。
返回
true 如果 s 已成功转换,则为 :否则为 false。
适用于
TryParseExact(String, String[], TimeOnly)
- Source:
- TimeOnly.cs
- Source:
- TimeOnly.cs
- Source:
- TimeOnly.cs
- Source:
- TimeOnly.cs
- Source:
- TimeOnly.cs
将时间的指定字符串表示形式转换为等效 TimeOnly 值,并返回一个值,该值指示转换是否成功。
public:
static bool TryParseExact(System::String ^ s, cli::array <System::String ^> ^ formats, [Runtime::InteropServices::Out] TimeOnly % result);
public static bool TryParseExact(string? s, string?[]? formats, out TimeOnly result);
static member TryParseExact : string * string[] * TimeOnly -> bool
Public Shared Function TryParseExact (s As String, formats As String(), ByRef result As TimeOnly) As Boolean
参数
- s
- String
包含分析时间的字符串。
- formats
- String[]
允许格式的 s数组。
- result
- TimeOnly
此方法返回时,包含 TimeOnly 与所包含 s时间等效的值(如果转换成功)或 TimeOnly.MinValue (如果转换失败)。 如果 s 为空字符串或不包含时间的有效字符串表示形式,则转换失败。 此参数未初始化传递。
返回
true 如果 s 已成功转换,则为 :否则为 false。
适用于
TryParseExact(String, String, IFormatProvider, DateTimeStyles, TimeOnly)
- Source:
- TimeOnly.cs
- Source:
- TimeOnly.cs
- Source:
- TimeOnly.cs
- Source:
- TimeOnly.cs
- Source:
- TimeOnly.cs
使用指定的格式、区域性特定的格式信息和样式,将时间的指定范围表示形式转换为其 TimeOnly 等效形式。 字符串表示形式的格式必须与指定的格式完全匹配。 该方法返回一个值,该值指示转换是否成功。
public:
static bool TryParseExact(System::String ^ s, System::String ^ format, IFormatProvider ^ provider, System::Globalization::DateTimeStyles style, [Runtime::InteropServices::Out] TimeOnly % result);
public static bool TryParseExact(string? s, string? format, IFormatProvider? provider, System.Globalization.DateTimeStyles style, out TimeOnly result);
static member TryParseExact : string * string * IFormatProvider * System.Globalization.DateTimeStyles * TimeOnly -> bool
Public Shared Function TryParseExact (s As String, format As String, provider As IFormatProvider, style As DateTimeStyles, ByRef result As TimeOnly) As Boolean
参数
- s
- String
包含表示转换时间的字符的范围。
- format
- String
所需的格式 s。
- provider
- IFormatProvider
一个对象,提供有关区域性特定的格式设置信息 s。
- style
- DateTimeStyles
一个或多个枚举值的按位组合,指示允许的格式 s。
- result
- TimeOnly
此方法返回时,包含 TimeOnly 与所包含 s时间等效的值(如果转换成功)或 TimeOnly.MinValue (如果转换失败)。 如果 s 为空字符串或不包含与格式指定的模式对应的时间,则转换失败。 此参数未初始化传递。
返回
true 如果 s 已成功转换,则为 :否则为 false。
适用于
TryParseExact(ReadOnlySpan<Char>, String[], TimeOnly)
- Source:
- TimeOnly.cs
- Source:
- TimeOnly.cs
- Source:
- TimeOnly.cs
- Source:
- TimeOnly.cs
- Source:
- TimeOnly.cs
将时间的指定字符范围转换为等效 TimeOnly 字符,并返回一个值,该值指示转换是否成功。
public:
static bool TryParseExact(ReadOnlySpan<char> s, cli::array <System::String ^> ^ formats, [Runtime::InteropServices::Out] TimeOnly % result);
public static bool TryParseExact(ReadOnlySpan<char> s, string?[]? formats, out TimeOnly result);
static member TryParseExact : ReadOnlySpan<char> * string[] * TimeOnly -> bool
Public Shared Function TryParseExact (s As ReadOnlySpan(Of Char), formats As String(), ByRef result As TimeOnly) As Boolean
参数
- s
- ReadOnlySpan<Char>
包含要转换的时间跨度。
- formats
- String[]
允许格式的 s数组。
- result
- TimeOnly
此方法返回时,包含 TimeOnly 与所包含 s时间等效的值(如果转换成功)或 TimeOnly.MinValue (如果转换失败)。 如果 s 参数为空字符串或不包含时间的有效字符串表示形式,则转换失败。 此参数未初始化传递。
返回
true 如果 s 已成功转换,则为 :否则为 false。
适用于
TryParseExact(ReadOnlySpan<Char>, ReadOnlySpan<Char>, TimeOnly)
- Source:
- TimeOnly.cs
- Source:
- TimeOnly.cs
- Source:
- TimeOnly.cs
- Source:
- TimeOnly.cs
- Source:
- TimeOnly.cs
使用指定的格式和样式将时间的指定范围表示形式转换为其 TimeOnly 等效的表示形式。 字符串表示形式的格式必须与指定的格式完全匹配。 该方法返回一个值,该值指示转换是否成功。
public:
static bool TryParseExact(ReadOnlySpan<char> s, ReadOnlySpan<char> format, [Runtime::InteropServices::Out] TimeOnly % result);
public static bool TryParseExact(ReadOnlySpan<char> s, ReadOnlySpan<char> format, out TimeOnly result);
static member TryParseExact : ReadOnlySpan<char> * ReadOnlySpan<char> * TimeOnly -> bool
Public Shared Function TryParseExact (s As ReadOnlySpan(Of Char), format As ReadOnlySpan(Of Char), ByRef result As TimeOnly) As Boolean
参数
- s
- ReadOnlySpan<Char>
包含转换时间的跨度。
- format
- ReadOnlySpan<Char>
所需的格式 s。
- result
- TimeOnly
此方法返回时,包含 TimeOnly 与所包含 s时间等效的值(如果转换成功)或 TimeOnly.MinValue (如果转换失败)。 如果 s 为空字符串或不包含与中指定的 format模式相对应的时间,则转换失败。 此参数未初始化传递。
返回
true 如果 s 已成功转换,则为 :否则为 false。
适用于
TryParseExact(String, String, TimeOnly)
- Source:
- TimeOnly.cs
- Source:
- TimeOnly.cs
- Source:
- TimeOnly.cs
- Source:
- TimeOnly.cs
- Source:
- TimeOnly.cs
使用指定的格式和样式将时间的指定字符串表示形式转换为等效 TimeOnly 的字符串表示形式。 字符串表示形式的格式必须与指定的格式完全匹配。 该方法返回一个值,该值指示转换是否成功。
public:
static bool TryParseExact(System::String ^ s, System::String ^ format, [Runtime::InteropServices::Out] TimeOnly % result);
public static bool TryParseExact(string? s, string? format, out TimeOnly result);
static member TryParseExact : string * string * TimeOnly -> bool
Public Shared Function TryParseExact (s As String, format As String, ByRef result As TimeOnly) As Boolean
参数
- s
- String
包含转换时间的字符串。
- format
- String
所需的格式 s。
- result
- TimeOnly
此方法返回时,包含 TimeOnly 与所包含 s时间等效的值(如果转换成功)或 TimeOnly.MinValue (如果转换失败)。 如果 s 为空字符串或不包含与格式指定的模式对应的时间,则转换失败。 此参数未初始化传递。
返回
true 如果 s 已成功转换,则为 :否则为 false。
适用于
TryParseExact(String, String[], IFormatProvider, DateTimeStyles, TimeOnly)
- Source:
- TimeOnly.cs
- Source:
- TimeOnly.cs
- Source:
- TimeOnly.cs
- Source:
- TimeOnly.cs
- Source:
- TimeOnly.cs
将时间的指定字符串表示形式转换为等效 TimeOnly 值,并返回一个值,该值指示转换是否成功。
public:
static bool TryParseExact(System::String ^ s, cli::array <System::String ^> ^ formats, IFormatProvider ^ provider, System::Globalization::DateTimeStyles style, [Runtime::InteropServices::Out] TimeOnly % result);
public static bool TryParseExact(string? s, string?[]? formats, IFormatProvider? provider, System.Globalization.DateTimeStyles style, out TimeOnly result);
static member TryParseExact : string * string[] * IFormatProvider * System.Globalization.DateTimeStyles * TimeOnly -> bool
Public Shared Function TryParseExact (s As String, formats As String(), provider As IFormatProvider, style As DateTimeStyles, ByRef result As TimeOnly) As Boolean
参数
- s
- String
包含分析时间的字符串。
- formats
- String[]
允许格式的 s数组。
- provider
- IFormatProvider
一个对象,提供有关区域性特定的格式设置信息 s。
- style
- DateTimeStyles
枚举值的按位组合,用于定义如何解释分析的日期。 要指定 None的典型值为 。
- result
- TimeOnly
此方法返回时,包含 TimeOnly 与所包含 s时间等效的值(如果转换成功)或 TimeOnly.MinValue (如果转换失败)。 如果 s 为空字符串或不包含时间的有效字符串表示形式,则转换失败。 此参数未初始化传递。
返回
true 如果 s 已成功转换,则为 :否则为 false。