String interpolation with ternary conditional operator [duplicate]

I want to create a datetime string but add CET/CEST depending if it's daylight savings or not.

$"{DateTime.Now.ToString("MMMM dd, yyyy, hh:mm tt"} {TimeZoneInfo.Utc.IsDaylightSavingTime(message.RegistrationTime) ? "CEST" : "CET"}

so if IsDaylightSavingTime returns true, append "CEST" string, if not, just "CET".

Is there an easy/quick way to do this?


You can wrap the ternary operator in () brackets when using string interpolation. So the ternary operator in the string interpolation would become:

 {(TimeZoneInfo.Utc.IsDaylightSavingTime(message.RegistrationTime) ? "CEST" : "CET")}