Uploaded image for project: 'C# Driver'
  1. C# Driver
  2. CSHARP-4469

LINQ support for `switch-case` expression

    XMLWordPrintableJSON

Details

    • Icon: Improvement Improvement
    • Resolution: Won't Do
    • Icon: Unknown Unknown
    • None
    • 2.18.0
    • None
    • None

    Description

      How to use `$switch`/`$branch`/`$case` with LINQ v3?

      I find that `p => p.Mode == 1 ? "A" : "B"` will be translated into `$cond`/`$if`/`$else`. But currently it seems does not support `switch` pattern:

      p => p.Mode switch
      {
          1 => "A",
          2 => "B",
          _ => "Z"
      }

      Any possibility to implement it? Or did I miss something already documented before?

      Thanks in advance.

      Attachments

        Activity

          People

            robert@mongodb.com Robert Stam
            petergeorge@126.com LeaFrock N/A
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: