Class TimeSpanFormatAttribute
Defines the format for string-serialized System.TimeSpan objects.
Namespace: DisCatSharp.Common.Serialization
Assembly: DisCatSharp.Common.dll
Syntax
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field)]
public sealed class TimeSpanFormatAttribute : SerializationAttribute
Constructors
| Improve this Doc View SourceTimeSpanFormatAttribute(TimeSpanFormatKind)
Specifies a predefined format to use.
Declaration
public TimeSpanFormatAttribute(TimeSpanFormatKind kind)
Parameters
Type | Name | Description |
---|---|---|
TimeSpanFormatKind | kind | Predefined format kind to use. |
TimeSpanFormatAttribute(String)
Specifies a custom format to use.
See https://docs.microsoft.com/en-us/dotnet/standard/base-types/custom-timespan-format-strings for more details.
Declaration
public TimeSpanFormatAttribute(string format)
Parameters
Type | Name | Description |
---|---|---|
System.String | format | Custom format string to use. |
Fields
| Improve this Doc View SourceFORMAT_CONSTANT
Gets the constant format.
Declaration
public const string FORMAT_CONSTANT = "c"
Field Value
Type | Description |
---|---|
System.String |
FORMAT_ISO_8601
Gets the ISO 8601 format string of @"ddThh:mm:ss.fff".
Declaration
public const string FORMAT_ISO_8601 = "ddThh\\:mm\\:ss\\.fff"
Field Value
Type | Description |
---|---|
System.String |
FORMAT_LONG
Gets the general long format.
Declaration
public const string FORMAT_LONG = "G"
Field Value
Type | Description |
---|---|
System.String |
FORMAT_SHORT
Gets the general short format.
Declaration
public const string FORMAT_SHORT = "g"
Field Value
Type | Description |
---|---|
System.String |
Properties
| Improve this Doc View SourceFormat
Gets the custom datetime format string to use.
Declaration
public string Format { get; }
Property Value
Type | Description |
---|---|
System.String |
Kind
Gets the predefined datetime format kind.
Declaration
public TimeSpanFormatKind Kind { get; }
Property Value
Type | Description |
---|---|
TimeSpanFormatKind |