jeudi 1 octobre 2020

C# comma usage in a ternary operator

Is there any analogy like in C that the comma operator can be used in C# as well as following.

 templateCode = myBoolFlag ? ((smsNotification.NewNumber = request.NewNumber), "NEWCARDSTR")
                                       : request.NewCardStatus == "L" || request.NewCardStatus == "S" 
                                           ? "STRING1" 
                                           : "STRING2";

Aucun commentaire:

Enregistrer un commentaire