C#C
C#13mo ago
SWEETPONY

Is it possible to use pattern matching here?

I want smth like this:
var isInbound = entity.LegData!.Location.LatestArrivalStationIataCode == "SVO";
var isOutbound = entity.LegData!.Location.LatestDepartureStationIataCode == "SVO";

return new PresentationModel
{
     Terminal = 
         isInbound => entity.LegData!.Location.ArrivalTerminal
         isOutbound => entity.LegData!.Location.DepartureTerminal
}
Was this page helpful?