Skip to content

C# Language Reference expressions: throw #1373

Closed

Description

@BillWagner

Starting in C# 7, throw can now be an expression as well as a statement.

Activity

  1. BillWagner commented on Dec 28, 2016

    @BillWagner
    MemberAuthor

    @MadsTorgersen Is it correct to say that throw can be used both as a statement or an expression, or is it always an expression starting in C# 7?

  2. MadsTorgersen commented on Jan 3, 2017

    @MadsTorgersen
    Contributor

    I believe we keep separate notions of throw expressions and throw statements. @gafter may be able to elaborate.

  3. gafter commented on Jan 3, 2017

    @gafter
    Member

    Yes, it is separately a statement and expression. The reason we keep the statement form is that it has unique reachability behavior that is different from other expression-statements. Specifically, its endpoint is not reachable.

  4. modified the milestone: on Jan 9, 2017
  5. modified the milestones: March 2017, on Mar 21, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions