C#C
C#3y ago
SWEETPONY

❔ How to correctly write this linq query?

I have following code:
private string FormatLocalDateLong(LocalDate localDate)
    => localDate
          .ToString( "dd.MM.yyyy", _ruCulture );


I decided to extand function and did this:
private string FormatLocalDateLong( LocalDate localDate )
   => localDate
        .ToString( "dd.MM.yyyy", _ruCulture )
        .FormatResolvedValues();

public static string FormatResolvedValues( this string localDate )
        => localDate.EndsWith( "9999" )
            ? "/"
            : localDate;  


All I want is to write the same without extansion FormatResolvedValues
Smth like that but I don't understand how to write it correctly:
private string FormatLocalDateLong( LocalDate localDate )
   => localDate
        .ToString( "dd.MM.yyyy", _ruCulture )
        .EndsWith("9999")
             ? "/"
             : ... (I don't want to write .ToString() again);
Was this page helpful?