13 instantiations of TimeOnly
Microsoft.AspNetCore.Components.Endpoints.Tests (2)
Binding\FormDataMapperTests.cs (2)
2128{ "12:56:34", typeof(TimeOnly?), new TimeOnly?(new TimeOnly(12, 56, 34))}, 2213{ "12:56:34", typeof(TimeOnly), new TimeOnly(12, 56, 34) },
Microsoft.AspNetCore.Components.Tests (2)
PersistentStateValueProviderKeyResolverTests.cs (2)
39{ new TimeOnly(12, 34, 56), new TimeOnly(23, 45, 56) },
Microsoft.AspNetCore.Http.Extensions.Tests (1)
RequestDelegateGenerator\RequestDelegateCreationTests.TryParse.cs (1)
45new object[] { "TimeOnly", "4:34 PM ", new TimeOnly(16, 34) },
Microsoft.Extensions.AI.Abstractions.Tests (1)
test\Shared\JsonSchemaExporter\TestTypes.cs (1)
96yield return new TestData<TimeOnly>(new(hour: 22, minute: 30, second: 33, millisecond: 100), """{"type":"string","format": "time"}""");
Microsoft.Gen.Logging.Generated.Tests (1)
LogPropertiesTests.cs (1)
111P19 = new TimeOnly(123),
System.Private.CoreLib (6)
src\libraries\System.Private.CoreLib\src\System\TimeOnly.cs (6)
35public static TimeOnly MinValue => new TimeOnly((ulong)MinTimeTicks); 40public static TimeOnly MaxValue => new TimeOnly((ulong)MaxTimeTicks); 128private TimeOnly AddTicks(long ticks) => new TimeOnly((_ticks + TimeSpan.TicksPerDay + (ulong)(ticks % TimeSpan.TicksPerDay)) % TimeSpan.TicksPerDay); 146return new TimeOnly((ulong)newTicks); 371public static TimeOnly FromTimeSpan(TimeSpan timeSpan) => new TimeOnly(timeSpan._ticks); 378public static TimeOnly FromDateTime(DateTime dateTime) => new TimeOnly((ulong)dateTime.TimeOfDay.Ticks);
251 references to TimeOnly
Microsoft.AspNetCore.Components (72)
BindConverter.cs (34)
518return value.ToDateTime(TimeOnly.MinValue).ToString(format, culture ?? CultureInfo.CurrentCulture); 562return value.Value.ToDateTime(TimeOnly.MinValue).ToString(format, culture ?? CultureInfo.CurrentCulture); 587public static string FormatValue(TimeOnly value, CultureInfo? culture = null) => FormatTimeOnlyValueCore(value, format: null, culture); 599public static string FormatValue(TimeOnly value, [StringSyntax(StringSyntaxAttribute.TimeOnlyFormat)] string format, CultureInfo? culture = null) => FormatTimeOnlyValueCore(value, format, culture); 601private static string FormatTimeOnlyValueCore(TimeOnly value, string? format, CultureInfo? culture) 612private static string FormatTimeOnlyValueCore(TimeOnly value, CultureInfo? culture) 626public static string? FormatValue(TimeOnly? value, CultureInfo? culture = null) => FormatNullableTimeOnlyValueCore(value, format: null, culture); 638public static string? FormatValue(TimeOnly? value, [StringSyntax(StringSyntaxAttribute.TimeOnlyFormat)] string format, CultureInfo? culture = null) => FormatNullableTimeOnlyValueCore(value, format, culture); 640private static string? FormatNullableTimeOnlyValueCore(TimeOnly? value, string? format, CultureInfo? culture) 656private static string? FormatNullableTimeOnlyValueCore(TimeOnly? value, CultureInfo? culture) 1485/// Attempts to convert a value to a <see cref="System.TimeOnly"/>. 1491public static bool TryConvertToTimeOnly(object? obj, CultureInfo? culture, out TimeOnly value) 1497/// Attempts to convert a value to a <see cref="System.TimeOnly"/>. 1504public static bool TryConvertToTimeOnly(object? obj, CultureInfo? culture, [StringSyntax(StringSyntaxAttribute.TimeOnlyFormat)] string format, out TimeOnly value) 1510/// Attempts to convert a value to a nullable <see cref="System.TimeOnly"/>. 1516public static bool TryConvertToNullableTimeOnly(object? obj, CultureInfo? culture, out TimeOnly? value) 1522/// Attempts to convert a value to a nullable <see cref="System.TimeOnly"/>. 1529public static bool TryConvertToNullableTimeOnly(object? obj, CultureInfo? culture, [StringSyntax(StringSyntaxAttribute.TimeOnlyFormat)] string format, out TimeOnly? value) 1534internal static BindParser<TimeOnly> ConvertToTimeOnly = ConvertToTimeOnlyCore; 1535internal static BindParserWithFormat<TimeOnly> ConvertToTimeOnlyWithFormat = ConvertToTimeOnlyCore; 1536internal static BindParser<TimeOnly?> ConvertToNullableTimeOnly = ConvertToNullableTimeOnlyCore; 1537internal static BindParserWithFormat<TimeOnly?> ConvertToNullableTimeOnlyWithFormat = ConvertToNullableTimeOnlyCore; 1539private static bool ConvertToTimeOnlyCore(object? obj, CultureInfo? culture, out TimeOnly value) 1544private static bool ConvertToTimeOnlyCore(object? obj, CultureInfo? culture, string? format, out TimeOnly value) 1549value = TimeOnly.FromDateTime(dateTime); 1557private static bool ConvertToNullableTimeOnlyCore(object? obj, CultureInfo? culture, out TimeOnly? value) 1562private static bool ConvertToNullableTimeOnlyCore(object? obj, CultureInfo? culture, string? format, out TimeOnly? value) 1567value = TimeOnly.FromDateTime(dateTime); 1783else if (typeof(T) == typeof(TimeOnly)) 1785formatter = (BindFormatter<TimeOnly>)FormatTimeOnlyValueCore; 1787else if (typeof(T) == typeof(TimeOnly?)) 1789formatter = (BindFormatter<TimeOnly?>)FormatNullableTimeOnlyValueCore; 1982else if (typeof(T) == typeof(TimeOnly)) 1986else if (typeof(T) == typeof(TimeOnly?))
ChangeDetection.cs (1)
58|| type == typeof(TimeOnly)
EventCallbackFactoryBinderExtensions.cs (24)
1142Action<TimeOnly> setter, 1143TimeOnly existingValue, 1146return CreateBinderCore<TimeOnly>(factory, receiver, setter, culture, ConvertToTimeOnly); 1162Func<TimeOnly, Task> setter, 1163TimeOnly existingValue, 1166return CreateBinderCoreAsync<TimeOnly>(factory, receiver, setter, culture, ConvertToTimeOnly); 1183Action<TimeOnly> setter, 1184TimeOnly existingValue, 1188return CreateBinderCore<TimeOnly>(factory, receiver, setter, culture, format, ConvertToTimeOnlyWithFormat); 1205Func<TimeOnly, Task> setter, 1206TimeOnly existingValue, 1210return CreateBinderCoreAsync<TimeOnly>(factory, receiver, setter, culture, format, ConvertToTimeOnlyWithFormat); 1226Action<TimeOnly?> setter, 1227TimeOnly? existingValue, 1230return CreateBinderCore<TimeOnly?>(factory, receiver, setter, culture, ConvertToNullableTimeOnly); 1246Func<TimeOnly?, Task> setter, 1247TimeOnly? existingValue, 1250return CreateBinderCoreAsync<TimeOnly?>(factory, receiver, setter, culture, ConvertToNullableTimeOnly); 1267Action<TimeOnly?> setter, 1268TimeOnly? existingValue, 1272return CreateBinderCore<TimeOnly?>(factory, receiver, setter, culture, format, ConvertToNullableTimeOnlyWithFormat); 1289Func<TimeOnly?, Task> setter, 1290TimeOnly? existingValue, 1294return CreateBinderCoreAsync<TimeOnly?>(factory, receiver, setter, culture, format, ConvertToNullableTimeOnlyWithFormat);
NavigationManagerExtensions.cs (6)
32[typeof(TimeOnly)] = value => Format((TimeOnly)value), 62private static string Format(TimeOnly value) 65private static string? Format(TimeOnly? value) 350public static string GetUriWithQueryParameter(this NavigationManager navigationManager, string name, TimeOnly value) 364public static string GetUriWithQueryParameter(this NavigationManager navigationManager, string name, TimeOnly? value)
PersistentState\PersistentStateValueProviderKeyResolver.cs (1)
210|| keyType == typeof(TimeOnly);
Routing\UrlValueConstraint.cs (6)
47private static bool TryParse(ReadOnlySpan<char> str, out TimeOnly result) 48=> TimeOnly.TryParse(str, CultureInfo.InvariantCulture, DateTimeStyles.None, out result); 74var x when x == typeof(TimeOnly) => new TypedUrlValueConstraint<TimeOnly>(TryParse), 75var x when x == typeof(TimeOnly?) => new NullableTypedUrlValueConstraint<TimeOnly>(TryParse),
Microsoft.AspNetCore.Components.Endpoints (7)
FormMapping\Converters\NullableConverter.cs (1)
66return type == typeof(DateOnly) || type == typeof(TimeOnly) || type == typeof(DateTimeOffset);
FormMapping\WellKnownConverters.cs (6)
44{ typeof(TimeOnly), new ParsableConverter<TimeOnly>() }, 76converters.Add(typeof(TimeOnly?), new NullableConverter<TimeOnly>((FormDataConverter<TimeOnly>)converters[typeof(TimeOnly)]));
Microsoft.AspNetCore.Components.Endpoints.Tests (4)
Binding\FormDataMapperTests.cs (4)
2128{ "12:56:34", typeof(TimeOnly?), new TimeOnly?(new TimeOnly(12, 56, 34))}, 2170{ typeof(TimeOnly?) }, 2213{ "12:56:34", typeof(TimeOnly), new TimeOnly(12, 56, 34) },
Microsoft.AspNetCore.Components.Tests (6)
BindConverterTest.cs (4)
217var value = TimeOnly.FromDateTime(DateTime.Now); 231var value = TimeOnly.FromDateTime(DateTime.Now);
RenderTreeDiffBuilderTest.cs (2)
1740var timeOnlyWillNotChange = TimeOnly.FromDateTime(dateTimeWillNotChange);
Microsoft.AspNetCore.Components.Web (3)
Forms\InputDate.cs (3)
18/// <item><description><see cref="TimeOnly"/></description></item> 60type != typeof(TimeOnly)) 105TimeOnly timeOnlyValue => BindConverter.FormatValue(timeOnlyValue, _format, CultureInfo.InvariantCulture),
Microsoft.AspNetCore.Http.Extensions (11)
src\Components\Endpoints\src\FormMapping\Converters\NullableConverter.cs (1)
66return type == typeof(DateOnly) || type == typeof(TimeOnly) || type == typeof(DateTimeOffset);
src\Components\Endpoints\src\FormMapping\WellKnownConverters.cs (6)
44{ typeof(TimeOnly), new ParsableConverter<TimeOnly>() }, 76converters.Add(typeof(TimeOnly?), new NullableConverter<TimeOnly>((FormDataConverter<TimeOnly>)converters[typeof(TimeOnly)]));
src\Shared\ParameterBindingMethodCache.cs (4)
557else if (type == typeof(TimeOnly)) 559methodInfo = typeof(TimeOnly).GetMethod( 560nameof(TimeOnly.TryParse), 562new[] { typeof(string), typeof(IFormatProvider), typeof(DateTimeStyles), typeof(TimeOnly).MakeByRefType() });
Microsoft.AspNetCore.Http.Extensions.Tests (1)
ParameterBindingMethodCacheTests.cs (1)
65[InlineData(typeof(TimeOnly))]
Microsoft.AspNetCore.Mvc.Abstractions (4)
src\Shared\ParameterBindingMethodCache.cs (4)
557else if (type == typeof(TimeOnly)) 559methodInfo = typeof(TimeOnly).GetMethod( 560nameof(TimeOnly.TryParse), 562new[] { typeof(string), typeof(IFormatProvider), typeof(DateTimeStyles), typeof(TimeOnly).MakeByRefType() });
Microsoft.AspNetCore.Mvc.ApiExplorer (1)
EndpointModelMetadata.cs (1)
64|| underlyingType == typeof(TimeOnly)
Microsoft.AspNetCore.Mvc.ApiExplorer.Test (4)
EndpointMetadataApiDescriptionProviderTest.cs (4)
714AssertPathParameter(GetApiDescription((TimeOnly foo) => { }, "/{foo}"), typeof(TimeOnly)); 735AssertPathParameter(GetApiDescription((TimeOnly? foo) => { }, "/{foo}"), typeof(TimeOnly?));
Microsoft.AspNetCore.OpenApi (6)
Extensions\JsonNodeSchemaExtensions.cs (1)
47[typeof(TimeOnly)] = new() { Type = JsonSchemaType.String, Format = "time" },
Services\OpenApiConstants.cs (1)
64typeof(TimeOnly),
src\Shared\ParameterBindingMethodCache.cs (4)
557else if (type == typeof(TimeOnly)) 559methodInfo = typeof(TimeOnly).GetMethod( 560nameof(TimeOnly.TryParse), 562new[] { typeof(string), typeof(IFormatProvider), typeof(DateTimeStyles), typeof(TimeOnly).MakeByRefType() });
Microsoft.AspNetCore.OpenApi.Tests (3)
Services\OpenApiDocumentService\OpenApiDocumentServiceTests.RequestBody.cs (1)
912[([FromForm] TimeOnly id) => {}, JsonSchemaType.String, "time"],
Services\OpenApiSchemaService\OpenApiSchemaService.ParameterSchemas.cs (2)
38[(TimeOnly id) => {}, JsonSchemaType.String, "time"], 55[(TimeOnly? id) => {}, JsonSchemaType.String, "time"],
Microsoft.Extensions.AI.Abstractions (1)
src\Shared\JsonSchemaExporter\JsonSchemaExporter.cs (1)
621[typeof(TimeOnly)] = _ => new JsonSchema { Type = JsonSchemaType.String, Format = "time" },
Microsoft.Extensions.AI.Abstractions.Tests (3)
test\Shared\JsonSchemaExporter\TestTypes.cs (2)
96yield return new TestData<TimeOnly>(new(hour: 22, minute: 30, second: 33, millisecond: 100), """{"type":"string","format": "time"}"""); 1240[JsonSerializable(typeof(TimeOnly))]
Utilities\AIJsonUtilitiesTests.cs (1)
965public TimeOnly TimeOnlyProp { get; set; }
Microsoft.Extensions.AI.Integration.Tests (1)
ChatClientIntegrationTests.cs (1)
464AIFunctionFactory.Create((TimeOnly t) => t, createOptions()),
Microsoft.Extensions.Validation (1)
RuntimeValidatableParameterInfoResolver.cs (1)
93type == typeof(TimeOnly) ||
Microsoft.Extensions.Validation.Tests (1)
RuntimeValidatableParameterInfoResolverTests.cs (1)
46[InlineData(typeof(TimeOnly))]
Microsoft.Gen.Logging.Generated.Tests (1)
test\Generators\Microsoft.Gen.Logging\TestClasses\LogPropertiesSpecialTypesExtensions.cs (1)
38public TimeOnly P19 { get; set; }
PresentationCore.Tests (1)
System\Windows\DurationConverter.Tests.cs (1)
81[InlineData(typeof(TimeOnly))]
System.Collections.Immutable (1)
System\Collections\Frozen\Constants.cs (1)
70typeof(T) == typeof(TimeOnly) ||
System.ComponentModel.TypeConverter (14)
System\ComponentModel\ReflectTypeDescriptionProvider.cs (1)
176[typeof(TimeOnly)] = new IntrinsicTypeConverterData((type) => new TimeOnlyConverter()),
System\ComponentModel\TimeOnlyConverter.cs (13)
11/// Provides a type converter to convert <see cref='System.TimeOnly'/> objects to and from various other representations. 16/// Gets a value indicating whether this converter can convert an object in the given source type to a <see cref='System.TimeOnly'/> 32/// Converts the given value object to a <see cref='System.TimeOnly'/> object. 42return TimeOnly.MinValue; 57return TimeOnly.Parse(text, formatInfo); 61return TimeOnly.Parse(text, culture); 66throw new FormatException(SR.Format(SR.ConvertInvalidPrimitive, (string)value, nameof(TimeOnly)), e); 74/// Converts the given value object from a <see cref='System.TimeOnly'/> object using the arguments. 79if (destinationType == typeof(string) && value is TimeOnly timeOnly) 81if (timeOnly == TimeOnly.MinValue) 91if (destinationType == typeof(InstanceDescriptor) && value is TimeOnly time) 95return new InstanceDescriptor(typeof(TimeOnly).GetConstructor(new Type[] { typeof(long) }), new object[] { time.Ticks }); 98return new InstanceDescriptor(typeof(TimeOnly).GetConstructor(new Type[] { typeof(int), typeof(int), typeof(int), typeof(int), typeof(int) }),
System.Private.CoreLib (91)
src\libraries\System.Private.CoreLib\src\System\DateOnly.cs (2)
217public DateTime ToDateTime(TimeOnly time) => DateTime.CreateUnchecked(_dayNumber * TimeSpan.TicksPerDay + time.Ticks); 225public DateTime ToDateTime(TimeOnly time, DateTimeKind kind) => DateTime.SpecifyKind(ToDateTime(time), kind);
src\libraries\System.Private.CoreLib\src\System\DateTime.cs (8)
165/// Initializes a new instance of the <see cref="DateTime"/> structure to the specified <see cref="DateOnly"/> and <see cref="TimeOnly"/>. 174public DateTime(DateOnly date, TimeOnly time) 180/// Initializes a new instance of the <see cref="DateTime"/> structure to the specified <see cref="DateOnly"/> and <see cref="TimeOnly"/> respecting a <see cref="DateTimeKind"/>. 192public DateTime(DateOnly date, TimeOnly time, DateTimeKind kind) 1888/// Deconstructs <see cref="DateTime"/> into <see cref="DateOnly"/> and <see cref="TimeOnly"/>. 1894/// Deconstructed <see cref="TimeOnly"/>. 1897public void Deconstruct(out DateOnly date, out TimeOnly time) 1900time = TimeOnly.FromDateTime(this);
src\libraries\System.Private.CoreLib\src\System\DateTimeOffset.cs (4)
134public DateTimeOffset(DateOnly date, TimeOnly time, TimeSpan offset) 1011/// Deconstructs <see cref="DateTimeOffset"/> into <see cref="DateOnly"/>, <see cref="TimeOnly"/> and <see cref="TimeSpan"/>. 1017/// Deconstructed <see cref="TimeOnly"/> 1023public void Deconstruct(out DateOnly date, out TimeOnly time, out TimeSpan offset)
src\libraries\System.Private.CoreLib\src\System\Globalization\DateTimeFormat.cs (2)
1316internal static unsafe bool TryFormatTimeOnlyO<TChar>(TimeOnly value, Span<TChar> destination, out int charsWritten) where TChar : unmanaged, IUtfChar<TChar> 1344internal static unsafe bool TryFormatTimeOnlyR<TChar>(TimeOnly value, Span<TChar> destination, out int charsWritten) where TChar : unmanaged, IUtfChar<TChar>
src\libraries\System.Private.CoreLib\src\System\TimeOnly.cs (74)
17IComparable<TimeOnly>, 18IEquatable<TimeOnly>, 20ISpanParsable<TimeOnly>, 35public static TimeOnly MinValue => new TimeOnly((ulong)MinTimeTicks); 40public static TimeOnly MaxValue => new TimeOnly((ulong)MaxTimeTicks); 67/// Initializes a new instance of the <see cref="TimeOnly"/> structure to the specified hour, minute, second, and millisecond. 128private TimeOnly AddTicks(long ticks) => new TimeOnly((_ticks + TimeSpan.TicksPerDay + (ulong)(ticks % TimeSpan.TicksPerDay)) % TimeSpan.TicksPerDay); 130private TimeOnly AddTicks(long ticks, out int wrappedDays) 154public TimeOnly Add(TimeSpan value) => AddTicks(value.Ticks); 163public TimeOnly Add(TimeSpan value, out int wrappedDays) => AddTicks(value.Ticks, out wrappedDays); 170public TimeOnly AddHours(double value) => AddTicks((long)(value * TimeSpan.TicksPerHour)); 179public TimeOnly AddHours(double value, out int wrappedDays) => AddTicks((long)(value * TimeSpan.TicksPerHour), out wrappedDays); 186public TimeOnly AddMinutes(double value) => AddTicks((long)(value * TimeSpan.TicksPerMinute)); 195public TimeOnly AddMinutes(double value, out int wrappedDays) => AddTicks((long)(value * TimeSpan.TicksPerMinute), out wrappedDays); 208public bool IsBetween(TimeOnly start, TimeOnly end) 226public static bool operator ==(TimeOnly left, TimeOnly right) => left._ticks == right._ticks; 235public static bool operator !=(TimeOnly left, TimeOnly right) => left._ticks != right._ticks; 244public static bool operator >(TimeOnly left, TimeOnly right) => left._ticks > right._ticks; 253public static bool operator >=(TimeOnly left, TimeOnly right) => left._ticks >= right._ticks; 262public static bool operator <(TimeOnly left, TimeOnly right) => left._ticks < right._ticks; 271public static bool operator <=(TimeOnly left, TimeOnly right) => left._ticks <= right._ticks; 279public static TimeSpan operator -(TimeOnly t1, TimeOnly t2) 287/// Deconstructs <see cref="TimeOnly"/> by <see cref="Hour"/> and <see cref="Minute"/>. 303/// Deconstructs <see cref="TimeOnly"/> by <see cref="Hour"/>, <see cref="Minute"/> and <see cref="Second"/>. 321/// Deconstructs <see cref="TimeOnly"/> by <see cref="Hour"/>, <see cref="Minute"/>, <see cref="Second"/> and <see cref="Millisecond"/>. 342/// Deconstructs <see cref="TimeOnly"/> by <see cref="Hour"/>, <see cref="Minute"/>, <see cref="Second"/>, <see cref="Millisecond"/> and <see cref="Microsecond"/>. 371public static TimeOnly FromTimeSpan(TimeSpan timeSpan) => new TimeOnly(timeSpan._ticks); 378public static TimeOnly FromDateTime(DateTime dateTime) => new TimeOnly((ulong)dateTime.TimeOfDay.Ticks); 398public int CompareTo(TimeOnly value) => _ticks.CompareTo(value._ticks); 413if (value is not TimeOnly timeOnly) 426public bool Equals(TimeOnly value) => _ticks == value._ticks; 433public override bool Equals([NotNullWhen(true)] object? value) => value is TimeOnly timeOnly && _ticks == timeOnly._ticks; 456public static TimeOnly Parse(ReadOnlySpan<char> s, IFormatProvider? provider = default, DateTimeStyles style = DateTimeStyles.None) 458ParseFailureKind result = TryParseInternal(s, provider, style, out TimeOnly timeOnly); 479public static TimeOnly ParseExact(ReadOnlySpan<char> s, [StringSyntax(StringSyntaxAttribute.TimeOnlyFormat)] ReadOnlySpan<char> format, IFormatProvider? provider = default, DateTimeStyles style = DateTimeStyles.None) 481ParseFailureKind result = TryParseExactInternal(s, format, provider, style, out TimeOnly timeOnly); 497public static TimeOnly ParseExact(ReadOnlySpan<char> s, [StringSyntax(StringSyntaxAttribute.TimeOnlyFormat)] string[] formats) => ParseExact(s, formats, null, DateTimeStyles.None); 508public static TimeOnly ParseExact(ReadOnlySpan<char> s, [StringSyntax(StringSyntaxAttribute.TimeOnlyFormat)] string[] formats, IFormatProvider? provider, DateTimeStyles style = DateTimeStyles.None) 510ParseFailureKind result = TryParseExactInternal(s, formats, provider, style, out TimeOnly timeOnly); 524public static TimeOnly Parse(string s) => Parse(s, null, DateTimeStyles.None); 533public static TimeOnly Parse(string s, IFormatProvider? provider, DateTimeStyles style = DateTimeStyles.None) 546public static TimeOnly ParseExact(string s, [StringSyntax(StringSyntaxAttribute.TimeOnlyFormat)] string format) => ParseExact(s, format, null, DateTimeStyles.None); 557public static TimeOnly ParseExact(string s, [StringSyntax(StringSyntaxAttribute.TimeOnlyFormat)] string format, IFormatProvider? provider, DateTimeStyles style = DateTimeStyles.None) 571public static TimeOnly ParseExact(string s, [StringSyntax(StringSyntaxAttribute.TimeOnlyFormat)] string[] formats) => ParseExact(s, formats, null, DateTimeStyles.None); 582public static TimeOnly ParseExact(string s, [StringSyntax(StringSyntaxAttribute.TimeOnlyFormat)] string[] formats, IFormatProvider? provider, DateTimeStyles style = DateTimeStyles.None) 594public static bool TryParse(ReadOnlySpan<char> s, out TimeOnly result) => TryParse(s, null, DateTimeStyles.None, out result); 605public static bool TryParse(ReadOnlySpan<char> s, IFormatProvider? provider, DateTimeStyles style, out TimeOnly result) => 607private static ParseFailureKind TryParseInternal(ReadOnlySpan<char> s, IFormatProvider? provider, DateTimeStyles style, out TimeOnly result) 643public static bool TryParseExact(ReadOnlySpan<char> s, [StringSyntax(StringSyntaxAttribute.TimeOnlyFormat)] ReadOnlySpan<char> format, out TimeOnly result) => TryParseExact(s, format, null, DateTimeStyles.None, out result); 655public static bool TryParseExact(ReadOnlySpan<char> s, [StringSyntax(StringSyntaxAttribute.TimeOnlyFormat)] ReadOnlySpan<char> format, IFormatProvider? provider, DateTimeStyles style, out TimeOnly result) => 658private static ParseFailureKind TryParseExactInternal(ReadOnlySpan<char> s, ReadOnlySpan<char> format, IFormatProvider? provider, DateTimeStyles style, out TimeOnly result) 708public static bool TryParseExact(ReadOnlySpan<char> s, [NotNullWhen(true), StringSyntax(StringSyntaxAttribute.TimeOnlyFormat)] string?[]? formats, out TimeOnly result) => TryParseExact(s, formats, null, DateTimeStyles.None, out result); 719public static bool TryParseExact(ReadOnlySpan<char> s, [NotNullWhen(true), StringSyntax(StringSyntaxAttribute.TimeOnlyFormat)] string?[]? formats, IFormatProvider? provider, DateTimeStyles style, out TimeOnly result) => 722private static ParseFailureKind TryParseExactInternal(ReadOnlySpan<char> s, string?[]? formats, IFormatProvider? provider, DateTimeStyles style, out TimeOnly result) 779public static bool TryParse([NotNullWhen(true)] string? s, out TimeOnly result) => TryParse(s, null, DateTimeStyles.None, out result); 789public static bool TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, DateTimeStyles style, out TimeOnly result) 808public static bool TryParseExact([NotNullWhen(true)] string? s, [NotNullWhen(true), StringSyntax(StringSyntaxAttribute.TimeOnlyFormat)] string? format, out TimeOnly result) => TryParseExact(s, format, null, DateTimeStyles.None, out result); 820public static bool TryParseExact([NotNullWhen(true)] string? s, [NotNullWhen(true), StringSyntax(StringSyntaxAttribute.TimeOnlyFormat)] string? format, IFormatProvider? provider, DateTimeStyles style, out TimeOnly result) 838public static bool TryParseExact([NotNullWhen(true)] string? s, [NotNullWhen(true), StringSyntax(StringSyntaxAttribute.TimeOnlyFormat)] string?[]? formats, out TimeOnly result) => TryParseExact(s, formats, null, DateTimeStyles.None, out result); 849public static bool TryParseExact([NotNullWhen(true)] string? s, [NotNullWhen(true), StringSyntax(StringSyntaxAttribute.TimeOnlyFormat)] string?[]? formats, IFormatProvider? provider, DateTimeStyles style, out TimeOnly result) 870throw new FormatException(SR.Format(SR.Format_DateTimeOnlyContainsNoneDateParts, s.ToString(), nameof(TimeOnly))); 992throw new FormatException(SR.Format(SR.Format_DateTimeOnlyContainsNoneDateParts, format.ToString(), nameof(TimeOnly))); 1003public static TimeOnly Parse(string s, IFormatProvider? provider) => Parse(s, provider, DateTimeStyles.None); 1006public static bool TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, out TimeOnly result) => TryParse(s, provider, DateTimeStyles.None, out result); 1013public static TimeOnly Parse(ReadOnlySpan<char> s, IFormatProvider? provider) => Parse(s, provider, DateTimeStyles.None); 1016public static bool TryParse(ReadOnlySpan<char> s, IFormatProvider? provider, out TimeOnly result) => TryParse(s, provider, DateTimeStyles.None, out result);
src\libraries\System.Private.CoreLib\src\System\TimeZoneInfo.StringSerializer.cs (1)
538DateTime timeOfDay = TimeOnly.FromDateTime(GetNextDateTimeValue(TimeOfDayFormat)).ToDateTime();
System.Runtime (1)
artifacts\obj\System.Runtime\Debug\net10.0\System.Runtime.Forwards.cs (1)
845[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.TimeOnly))]
System.Text.Json (13)
System\Text\Json\Nodes\JsonValueOfT.cs (1)
94type == typeof(DateOnly) || type == typeof(TimeOnly) ||
System\Text\Json\Serialization\Converters\Value\TimeOnlyConverter.cs (9)
11internal sealed class TimeOnlyConverter : JsonPrimitiveConverter<TimeOnly> 17public override TimeOnly Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) 27internal override TimeOnly ReadAsPropertyNameCore(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) 33private static TimeOnly ReadCore(ref Utf8JsonReader reader) 75Debug.Assert(TimeOnly.MinValue.ToTimeSpan() <= timespan && timespan <= TimeOnly.MaxValue.ToTimeSpan()); 76return TimeOnly.FromTimeSpan(timespan); 79public override void Write(Utf8JsonWriter writer, TimeOnly value, JsonSerializerOptions options) 89internal override void WriteAsPropertyNameCore(Utf8JsonWriter writer, TimeOnly value, JsonSerializerOptions options, bool isWritingExtensionDataProperty)
System\Text\Json\Serialization\Metadata\JsonMetadataServices.Converters.cs (3)
62/// Returns a <see cref="JsonConverter{T}"/> instance that converts <see cref="TimeOnly"/> values. 65public static JsonConverter<TimeOnly> TimeOnlyConverter => s_timeOnlyConverter ??= new TimeOnlyConverter(); 66private static JsonConverter<TimeOnly>? s_timeOnlyConverter;