@@ -335,7 +335,7 @@ private static string FormatDecimalValueCore(decimal value, CultureInfo? culture
335
335
/// </param>
336
336
/// <returns>The formatted value.</returns>
337
337
[ SuppressMessage ( "ApiDesign" , "RS0026:Do not add multiple public overloads with optional parameters" , Justification = "Required to maintain compatibility" ) ]
338
- public static string FormatValue ( DateTime value , string format , CultureInfo ? culture = null ) => FormatDateTimeValueCore ( value , format , culture ) ;
338
+ public static string FormatValue ( DateTime value , [ StringSyntax ( StringSyntaxAttribute . DateTimeFormat ) ] string format , CultureInfo ? culture = null ) => FormatDateTimeValueCore ( value , format , culture ) ;
339
339
340
340
private static string FormatDateTimeValueCore ( DateTime value , string ? format , CultureInfo ? culture )
341
341
{
@@ -373,7 +373,7 @@ private static string FormatDateTimeValueCore(DateTime value, CultureInfo? cultu
373
373
/// </param>
374
374
/// <returns>The formatted value.</returns>
375
375
[ SuppressMessage ( "ApiDesign" , "RS0026:Do not add multiple public overloads with optional parameters" , Justification = "Required to maintain compatibility" ) ]
376
- public static string ? FormatValue ( DateTime ? value , string ? format , CultureInfo ? culture = null ) => FormatNullableDateTimeValueCore ( value , format , culture ) ;
376
+ public static string ? FormatValue ( DateTime ? value , [ StringSyntax ( StringSyntaxAttribute . DateTimeFormat ) ] string ? format , CultureInfo ? culture = null ) => FormatNullableDateTimeValueCore ( value , format , culture ) ;
377
377
378
378
private static string ? FormatNullableDateTimeValueCore ( DateTime ? value , string ? format , CultureInfo ? culture )
379
379
{
@@ -507,7 +507,7 @@ private static string FormatDateTimeOffsetValueCore(DateTimeOffset value, Cultur
507
507
/// </param>
508
508
/// <returns>The formatted value.</returns>
509
509
[ SuppressMessage ( "ApiDesign" , "RS0026:Do not add multiple public overloads with optional parameters" , Justification = "Required to maintain compatibility" ) ]
510
- public static string FormatValue ( DateOnly value , string format , CultureInfo ? culture = null ) => FormatDateOnlyValueCore ( value , format , culture ) ;
510
+ public static string FormatValue ( DateOnly value , [ StringSyntax ( StringSyntaxAttribute . DateOnlyFormat ) ] string format , CultureInfo ? culture = null ) => FormatDateOnlyValueCore ( value , format , culture ) ;
511
511
512
512
private static string FormatDateOnlyValueCore ( DateOnly value , string ? format , CultureInfo ? culture )
513
513
{
@@ -546,7 +546,7 @@ private static string FormatDateOnlyValueCore(DateOnly value, CultureInfo? cultu
546
546
/// </param>
547
547
/// <returns>The formatted value.</returns>
548
548
[ SuppressMessage ( "ApiDesign" , "RS0026:Do not add multiple public overloads with optional parameters" , Justification = "Required to maintain compatibility" ) ]
549
- public static string ? FormatValue ( DateOnly ? value , string format , CultureInfo ? culture = null ) => FormatNullableDateOnlyValueCore ( value , format , culture ) ;
549
+ public static string ? FormatValue ( DateOnly ? value , [ StringSyntax ( StringSyntaxAttribute . DateOnlyFormat ) ] string format , CultureInfo ? culture = null ) => FormatNullableDateOnlyValueCore ( value , format , culture ) ;
550
550
551
551
private static string ? FormatNullableDateOnlyValueCore ( DateOnly ? value , string ? format , CultureInfo ? culture )
552
552
{
@@ -595,7 +595,7 @@ private static string FormatDateOnlyValueCore(DateOnly value, CultureInfo? cultu
595
595
/// </param>
596
596
/// <returns>The formatted value.</returns>
597
597
[ SuppressMessage ( "ApiDesign" , "RS0026:Do not add multiple public overloads with optional parameters" , Justification = "Required to maintain compatibility" ) ]
598
- public static string FormatValue ( TimeOnly value , string format , CultureInfo ? culture = null ) => FormatTimeOnlyValueCore ( value , format , culture ) ;
598
+ public static string FormatValue ( TimeOnly value , [ StringSyntax ( StringSyntaxAttribute . TimeOnlyFormat ) ] string format , CultureInfo ? culture = null ) => FormatTimeOnlyValueCore ( value , format , culture ) ;
599
599
600
600
private static string FormatTimeOnlyValueCore ( TimeOnly value , string ? format , CultureInfo ? culture )
601
601
{
@@ -634,7 +634,7 @@ private static string FormatTimeOnlyValueCore(TimeOnly value, CultureInfo? cultu
634
634
/// </param>
635
635
/// <returns>The formatted value.</returns>
636
636
[ SuppressMessage ( "ApiDesign" , "RS0026:Do not add multiple public overloads with optional parameters" , Justification = "Required to maintain compatibility" ) ]
637
- public static string ? FormatValue ( TimeOnly ? value , string format , CultureInfo ? culture = null ) => FormatNullableTimeOnlyValueCore ( value , format , culture ) ;
637
+ public static string ? FormatValue ( TimeOnly ? value , [ StringSyntax ( StringSyntaxAttribute . TimeOnlyFormat ) ] string format , CultureInfo ? culture = null ) => FormatNullableTimeOnlyValueCore ( value , format , culture ) ;
638
638
639
639
private static string ? FormatNullableTimeOnlyValueCore ( TimeOnly ? value , string ? format , CultureInfo ? culture )
640
640
{
@@ -1183,7 +1183,7 @@ public static bool TryConvertToDateTime(object? obj, CultureInfo? culture, out D
1183
1183
/// <param name="format">The format string to use in conversion.</param>
1184
1184
/// <param name="value">The converted value.</param>
1185
1185
/// <returns><c>true</c> if conversion is successful, otherwise <c>false</c>.</returns>
1186
- public static bool TryConvertToDateTime ( object ? obj , CultureInfo ? culture , string format , out DateTime value )
1186
+ public static bool TryConvertToDateTime ( object ? obj , CultureInfo ? culture , [ StringSyntax ( StringSyntaxAttribute . DateTimeFormat ) ] string format , out DateTime value )
1187
1187
{
1188
1188
return ConvertToDateTimeCore ( obj , culture , format , out value ) ;
1189
1189
}
@@ -1208,7 +1208,7 @@ public static bool TryConvertToNullableDateTime(object? obj, CultureInfo? cultur
1208
1208
/// <param name="format">The format string to use in conversion.</param>
1209
1209
/// <param name="value">The converted value.</param>
1210
1210
/// <returns><c>true</c> if conversion is successful, otherwise <c>false</c>.</returns>
1211
- public static bool TryConvertToNullableDateTime ( object ? obj , CultureInfo ? culture , string format , out DateTime ? value )
1211
+ public static bool TryConvertToNullableDateTime ( object ? obj , CultureInfo ? culture , [ StringSyntax ( StringSyntaxAttribute . DateTimeFormat ) ] string format , out DateTime ? value )
1212
1212
{
1213
1213
return ConvertToNullableDateTimeCore ( obj , culture , format , out value ) ;
1214
1214
}
@@ -1409,7 +1409,7 @@ public static bool TryConvertToDateOnly(object? obj, CultureInfo? culture, out D
1409
1409
/// <param name="format">The format string to use in conversion.</param>
1410
1410
/// <param name="value">The converted value.</param>
1411
1411
/// <returns><c>true</c> if conversion is successful, otherwise <c>false</c>.</returns>
1412
- public static bool TryConvertToDateOnly ( object ? obj , CultureInfo ? culture , string format , out DateOnly value )
1412
+ public static bool TryConvertToDateOnly ( object ? obj , CultureInfo ? culture , [ StringSyntax ( StringSyntaxAttribute . DateOnlyFormat ) ] string format , out DateOnly value )
1413
1413
{
1414
1414
return ConvertToDateOnlyCore ( obj , culture , format , out value ) ;
1415
1415
}
@@ -1434,7 +1434,7 @@ public static bool TryConvertToNullableDateOnly(object? obj, CultureInfo? cultur
1434
1434
/// <param name="format">The format string to use in conversion.</param>
1435
1435
/// <param name="value">The converted value.</param>
1436
1436
/// <returns><c>true</c> if conversion is successful, otherwise <c>false</c>.</returns>
1437
- public static bool TryConvertToNullableDateOnly ( object ? obj , CultureInfo ? culture , string format , out DateOnly ? value )
1437
+ public static bool TryConvertToNullableDateOnly ( object ? obj , CultureInfo ? culture , [ StringSyntax ( StringSyntaxAttribute . DateOnlyFormat ) ] string format , out DateOnly ? value )
1438
1438
{
1439
1439
return ConvertToNullableDateOnlyCore ( obj , culture , format , out value ) ;
1440
1440
}
@@ -1500,7 +1500,7 @@ public static bool TryConvertToTimeOnly(object? obj, CultureInfo? culture, out T
1500
1500
/// <param name="format">The format string to use in conversion.</param>
1501
1501
/// <param name="value">The converted value.</param>
1502
1502
/// <returns><c>true</c> if conversion is successful, otherwise <c>false</c>.</returns>
1503
- public static bool TryConvertToTimeOnly ( object ? obj , CultureInfo ? culture , string format , out TimeOnly value )
1503
+ public static bool TryConvertToTimeOnly ( object ? obj , CultureInfo ? culture , [ StringSyntax ( StringSyntaxAttribute . TimeOnlyFormat ) ] string format , out TimeOnly value )
1504
1504
{
1505
1505
return ConvertToTimeOnlyCore ( obj , culture , format , out value ) ;
1506
1506
}
@@ -1525,7 +1525,7 @@ public static bool TryConvertToNullableTimeOnly(object? obj, CultureInfo? cultur
1525
1525
/// <param name="format">The format string to use in conversion.</param>
1526
1526
/// <param name="value">The converted value.</param>
1527
1527
/// <returns><c>true</c> if conversion is successful, otherwise <c>false</c>.</returns>
1528
- public static bool TryConvertToNullableTimeOnly ( object ? obj , CultureInfo ? culture , string format , out TimeOnly ? value )
1528
+ public static bool TryConvertToNullableTimeOnly ( object ? obj , CultureInfo ? culture , [ StringSyntax ( StringSyntaxAttribute . TimeOnlyFormat ) ] string format , out TimeOnly ? value )
1529
1529
{
1530
1530
return ConvertToNullableTimeOnlyCore ( obj , culture , format , out value ) ;
1531
1531
}
0 commit comments