dotnet / dotnet/csharplang

[Proposal]: Block-bodied switch expression arms

Open
#8,610 0 comments 0 reactions 1 assignee Claimed by @333fred View on GitHub
Proposal champion
Dominant language
C#
Stars
12.7k
Forks
1.1k
Avg merge
11h 1m
Merged PRs (30d)
3

Description

# Block-bodied switch expression arms

* Specification: https://github.com/dotnet/csharplang/blob/159fb27e434f9bc41362f65e5ff9fe16647c4dd2/proposals/block-bodied-switch-expression-arms.md
* Discussion: https://github.com/dotnet/csharplang/discussions/8607

## Summary
[summary]: #summary

This proposal is an enhancement to the new switch expressions added in C# 8.0: allowing multiple statements in a switch expression arm. We permit braces after the arrow, and use break value; to return a value from the switch expression arm.

## Design meetings

https://github.com/dotnet/csharplang/blob/main/meetings/2022/LDM-2022-09-26.md#discriminated-unions
https://github.com/dotnet/csharplang/blob/main/meetings/2024/LDM-2024-08-28.md#block-bodied-switch-expression-arms

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.