Interface IPattern<T>
Generic interface supporting parsing and formatting. Parsing always results in a
ParseResult<T> which can represent success or failure.
Since 1.0.x
Availability net35-Client, PCL
Namespace: NodaTime.Text
Assembly: NodaTime.dll
Syntax
public interface IPattern<T>
Type Parameters
Name | Description |
---|---|
T | Type of value to parse or format. |
Remarks
Idiomatic text handling in Noda Time involves creating a pattern once and reusing it multiple
times, rather than specifying the pattern text repeatedly. All patterns are immutable and thread-safe,
and include the culture used for localization purposes.
Methods
Format(T)
Formats the given value as text according to the rules of this pattern.
Since 1.0.x
Availability net35-Client, PCL
Declaration
string Format(T value)
Parameters
Type | Name | Description |
---|---|---|
T | value | The value to format. |
Returns
Type | Description |
---|---|
String | The value formatted according to this pattern. |
Parse(String)
Parses the given text value according to the rules of this pattern.
Since 1.0.x
Availability net35-Client, PCL
Declaration
ParseResult<T> Parse(string text)
Parameters
Type | Name | Description |
---|---|---|
String | text | The text value to parse. |
Returns
Type | Description |
---|---|
Parse |
The result of parsing, which may be successful or unsuccessful. |
Remarks
This method never throws an exception (barring a bug in Noda Time itself). Even errors such as
the argument being null are wrapped in a parse result.