From bfd1c61c780f4bd34e3af27ba400c4202333b3e6 Mon Sep 17 00:00:00 2001 From: CyrusNajmabadi Date: Tue, 22 Aug 2017 23:53:19 -0700 Subject: [PATCH] Use pattern switch --- .../Formatting/Rules/WrappingFormattingRule.cs | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/Workspaces/CSharp/Portable/Formatting/Rules/WrappingFormattingRule.cs b/src/Workspaces/CSharp/Portable/Formatting/Rules/WrappingFormattingRule.cs index 0fd85b7bdfe..4933b66baca 100644 --- a/src/Workspaces/CSharp/Portable/Formatting/Rules/WrappingFormattingRule.cs +++ b/src/Workspaces/CSharp/Portable/Formatting/Rules/WrappingFormattingRule.cs @@ -56,14 +56,12 @@ public override void AddSuppressOperations(List list, SyntaxN } } - if (node is SwitchSectionSyntax switchSection) + switch (node) { - return ValueTuple.Create(switchSection.GetFirstToken(includeZeroWidth: true), switchSection.GetLastToken(includeZeroWidth: true)); - } - - if (node is AnonymousMethodExpressionSyntax anonymousMethod) - { - return ValueTuple.Create(anonymousMethod.DelegateKeyword, anonymousMethod.GetLastToken(includeZeroWidth: true)); + case SwitchSectionSyntax switchSection: + return ValueTuple.Create(switchSection.GetFirstToken(includeZeroWidth: true), switchSection.GetLastToken(includeZeroWidth: true)); + case AnonymousMethodExpressionSyntax anonymousMethod: + return ValueTuple.Create(anonymousMethod.DelegateKeyword, anonymousMethod.GetLastToken(includeZeroWidth: true)); } return default; -- GitLab