Επεξεργασία

Κοινή χρήση μέσω


TimeOnly.TryParse Method

Definition

Overloads

TryParse(ReadOnlySpan<Char>, IFormatProvider, DateTimeStyles, TimeOnly)

Converts the specified span representation of a time to its TimeOnly equivalent using the specified array of formats, culture-specific format information and style, and returns a value that indicates whether the conversion succeeded.

TryParse(ReadOnlySpan<Char>, TimeOnly)

Converts the specified span representation of a time to its TimeOnly equivalent and returns a value that indicates whether the conversion succeeded.

TryParse(String, TimeOnly)

Converts the specified string representation of a time to its TimeOnly equivalent and returns a value that indicates whether the conversion succeeded.

TryParse(ReadOnlySpan<Char>, IFormatProvider, TimeOnly)

Tries to parse a span of characters into a value.

TryParse(String, IFormatProvider, TimeOnly)

Tries to parse a string into a value.

TryParse(String, IFormatProvider, DateTimeStyles, TimeOnly)

Converts the specified string representation of a time to its TimeOnly equivalent using the specified array of formats, culture-specific format information and style, and returns a value that indicates whether the conversion succeeded.

TryParse(ReadOnlySpan<Char>, IFormatProvider, DateTimeStyles, TimeOnly)

Source:
TimeOnly.cs
Source:
TimeOnly.cs
Source:
TimeOnly.cs

Converts the specified span representation of a time to its TimeOnly equivalent using the specified array of formats, culture-specific format information and style, and returns a value that indicates whether the conversion succeeded.

public:
 static bool TryParse(ReadOnlySpan<char> s, IFormatProvider ^ provider, System::Globalization::DateTimeStyles style, [Runtime::InteropServices::Out] TimeOnly % result);
public static bool TryParse (ReadOnlySpan<char> s, IFormatProvider? provider, System.Globalization.DateTimeStyles style, out TimeOnly result);
static member TryParse : ReadOnlySpan<char> * IFormatProvider * System.Globalization.DateTimeStyles * TimeOnly -> bool
Public Shared Function TryParse (s As ReadOnlySpan(Of Char), provider As IFormatProvider, style As DateTimeStyles, ByRef result As TimeOnly) As Boolean

Parameters

s
ReadOnlySpan<Char>

A string containing the characters that represent a time to convert.

provider
IFormatProvider

An object that supplies culture-specific formatting information about s.

style
DateTimeStyles

A bitwise combination of enumeration values that indicates the permitted format of s. A typical value to specify is None.

result
TimeOnly

When this method returns, contains the TimeOnly value equivalent to the time contained in s, if the conversion succeeded, or TimeOnly.MinValue if the conversion failed. The conversion fails if s is an empty string or does not contain a valid string representation of a date. This parameter is passed uninitialized.

Returns

true ifs was converted successfully; otherwise, false.

Applies to

TryParse(ReadOnlySpan<Char>, TimeOnly)

Source:
TimeOnly.cs
Source:
TimeOnly.cs
Source:
TimeOnly.cs

Converts the specified span representation of a time to its TimeOnly equivalent and returns a value that indicates whether the conversion succeeded.

public:
 static bool TryParse(ReadOnlySpan<char> s, [Runtime::InteropServices::Out] TimeOnly % result);
public static bool TryParse (ReadOnlySpan<char> s, out TimeOnly result);
static member TryParse : ReadOnlySpan<char> * TimeOnly -> bool
Public Shared Function TryParse (s As ReadOnlySpan(Of Char), ByRef result As TimeOnly) As Boolean

Parameters

s
ReadOnlySpan<Char>

A span containing the characters representing the time to convert.

result
TimeOnly

When this method returns, contains the TimeOnly value equivalent to the time contained in s, if the conversion succeeded, or MinValue if the conversion failed. The conversion fails if s is the empty string or does not contain a valid string representation of a time. This parameter is passed uninitialized.

Returns

true if the conversion was successful; otherwise, false.

Applies to

TryParse(String, TimeOnly)

Source:
TimeOnly.cs
Source:
TimeOnly.cs
Source:
TimeOnly.cs

Converts the specified string representation of a time to its TimeOnly equivalent and returns a value that indicates whether the conversion succeeded.

public:
 static bool TryParse(System::String ^ s, [Runtime::InteropServices::Out] TimeOnly % result);
public static bool TryParse (string? s, out TimeOnly result);
static member TryParse : string * TimeOnly -> bool
Public Shared Function TryParse (s As String, ByRef result As TimeOnly) As Boolean

Parameters

s
String

A string containing the time to convert.

result
TimeOnly

When this method returns, contains the TimeOnly value equivalent to the time contained in s, if the conversion succeeded, or TimeOnly.MinValue if the conversion failed. The conversion fails if s is an empty string or does not contain a valid string representation of a time. This parameter is passed uninitialized.

Returns

true if s was converted successfully; otherwise, false.

Applies to

TryParse(ReadOnlySpan<Char>, IFormatProvider, TimeOnly)

Source:
TimeOnly.cs
Source:
TimeOnly.cs
Source:
TimeOnly.cs

Tries to parse a span of characters into a value.

public:
 static bool TryParse(ReadOnlySpan<char> s, IFormatProvider ^ provider, [Runtime::InteropServices::Out] TimeOnly % result) = ISpanParsable<TimeOnly>::TryParse;
public static bool TryParse (ReadOnlySpan<char> s, IFormatProvider? provider, out TimeOnly result);
static member TryParse : ReadOnlySpan<char> * IFormatProvider * TimeOnly -> bool
Public Shared Function TryParse (s As ReadOnlySpan(Of Char), provider As IFormatProvider, ByRef result As TimeOnly) As Boolean

Parameters

s
ReadOnlySpan<Char>

A span of characters to parse.

provider
IFormatProvider

An object that provides culture-specific formatting information about s.

result
TimeOnly

When this method returns, contains the TimeOnly value equivalent to the time contained in s, if the conversion succeeded, or MinValue if the conversion failed. The conversion fails if s is the empty string or does not contain a valid string representation of a time. This parameter is passed uninitialized.

Returns

true if s was successfully parsed; otherwise, false.

Applies to

TryParse(String, IFormatProvider, TimeOnly)

Source:
TimeOnly.cs
Source:
TimeOnly.cs
Source:
TimeOnly.cs

Tries to parse a string into a value.

public:
 static bool TryParse(System::String ^ s, IFormatProvider ^ provider, [Runtime::InteropServices::Out] TimeOnly % result) = IParsable<TimeOnly>::TryParse;
public static bool TryParse (string? s, IFormatProvider? provider, out TimeOnly result);
static member TryParse : string * IFormatProvider * TimeOnly -> bool
Public Shared Function TryParse (s As String, provider As IFormatProvider, ByRef result As TimeOnly) As Boolean

Parameters

s
String

A string to parse.

provider
IFormatProvider

An object that provides culture-specific formatting information about s.

result
TimeOnly

When this method returns, contains the TimeOnly value equivalent to the time contained in s, if the conversion succeeded, or MinValue if the conversion failed. The conversion fails if s is the empty string or does not contain a valid string representation of a time. This parameter is passed uninitialized.

Returns

true if s was parsed successfully; otherwise, false.

Applies to

TryParse(String, IFormatProvider, DateTimeStyles, TimeOnly)

Source:
TimeOnly.cs
Source:
TimeOnly.cs
Source:
TimeOnly.cs

Converts the specified string representation of a time to its TimeOnly equivalent using the specified array of formats, culture-specific format information and style, and returns a value that indicates whether the conversion succeeded.

public:
 static bool TryParse(System::String ^ s, IFormatProvider ^ provider, System::Globalization::DateTimeStyles style, [Runtime::InteropServices::Out] TimeOnly % result);
public static bool TryParse (string? s, IFormatProvider? provider, System.Globalization.DateTimeStyles style, out TimeOnly result);
static member TryParse : string * IFormatProvider * System.Globalization.DateTimeStyles * TimeOnly -> bool
Public Shared Function TryParse (s As String, provider As IFormatProvider, style As DateTimeStyles, ByRef result As TimeOnly) As Boolean

Parameters

s
String

A string containing the time to convert.

provider
IFormatProvider

The culture-specific formatting information about s.

style
DateTimeStyles

A bitwise combination of enumeration values that indicates the permitted format of s. A typical value to specify is None.

result
TimeOnly

When this method returns, contains the TimeOnly value equivalent to the time contained in s, if the conversion succeeded, or TimeOnly.MinValue if the conversion failed. The conversion fails if s is an empty string or does not contain a valid string representation of a time. This parameter is passed uninitialized.

Returns

true if s was converted successfully; otherwise, false.

Applies to