Class FastTimeSpanParser
Provides high-performance parsing and formatting of TimeSpan values based on a specified template.
public class FastTimeSpanParser
- Inheritance
-
FastTimeSpanParser
- Inherited Members
- Extension Methods
Constructors
FastTimeSpanParser(string)
Initializes a new instance of the FastTimeSpanParser class using the specified template.
public FastTimeSpanParser(string template)
Parameters
template
stringA format template that defines how TimeSpan values are parsed and formatted. Must not be null or empty.
Exceptions
- ArgumentNullException
Thrown when the provided template is null or empty.
Properties
Template
Gets the template string used for parsing and formatting TimeSpan values.
public string Template { get; }
Property Value
Methods
Parse(string)
Parses the specified input string into a TimeSpan value based on the parser's template.
public TimeSpan Parse(string input)
Parameters
input
stringThe string representation of a time span to parse.
Returns
Exceptions
- InvalidCastException
Thrown when the input cannot be converted to a TimeSpan using the provided template.
ToString()
public override string ToString()
Returns
ToString(TimeSpan)
Formats the specified TimeSpan value into a string using the parser's template.
public string ToString(TimeSpan value)