From 9deea735ee0716ebf8206f9f772251127e4197d6 Mon Sep 17 00:00:00 2001 From: Romfos Date: Tue, 27 Aug 2024 18:31:38 +0200 Subject: [PATCH] [.NET] Adopt c#12 collection initializers --- dotnet/Gherkin/AstBuilder.cs | 2 +- dotnet/Gherkin/GherkinDialectProvider.cs | 22 +++++++++++----------- dotnet/Gherkin/GherkinLine.cs | 2 +- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/dotnet/Gherkin/AstBuilder.cs b/dotnet/Gherkin/AstBuilder.cs index f23b0efb5..433af8ad9 100644 --- a/dotnet/Gherkin/AstBuilder.cs +++ b/dotnet/Gherkin/AstBuilder.cs @@ -258,7 +258,7 @@ private Tag[] GetTags(AstNode node) { var tagsNode = node.GetSingle(RuleType.Tags); if (tagsNode == null) - return new Tag[0]; + return []; return tagsNode.GetTokens(TokenType.TagLine) .SelectMany(t => t.MatchedItems, (t, tagItem) => diff --git a/dotnet/Gherkin/GherkinDialectProvider.cs b/dotnet/Gherkin/GherkinDialectProvider.cs index 70ba25e1a..ac3e17c57 100644 --- a/dotnet/Gherkin/GherkinDialectProvider.cs +++ b/dotnet/Gherkin/GherkinDialectProvider.cs @@ -99,17 +99,17 @@ protected static GherkinDialect GetFactoryDefault() { return new GherkinDialect( "en", - new[] { "Feature" }, - new[] { "Rule" }, - new[] { "Background" }, - new[] { "Scenario" }, - new[] { "Scenario Outline", "Scenario Template" }, - new[] { "Examples", "Scenarios" }, - new[] { "* ", "Given " }, - new[] { "* ", "When " }, - new[] { "* ", "Then " }, - new[] { "* ", "And " }, - new[] { "* ", "But " }); + ["Feature"], + ["Rule"], + ["Background"], + ["Scenario"], + ["Scenario Outline", "Scenario Template"], + ["Examples", "Scenarios"], + ["* ", "Given "], + ["* ", "When "], + ["* ", "Then "], + ["* ", "And "], + ["* ", "But "]); } } diff --git a/dotnet/Gherkin/GherkinLine.cs b/dotnet/Gherkin/GherkinLine.cs index 0fa824d46..46f4f3afe 100644 --- a/dotnet/Gherkin/GherkinLine.cs +++ b/dotnet/Gherkin/GherkinLine.cs @@ -5,7 +5,7 @@ namespace Gherkin; public class GherkinLine : IGherkinLine { - private static char[] inlineWhitespaceChars = new char[] { ' ', '\t', '\u00A0' }; + private static char[] inlineWhitespaceChars = [' ', '\t', '\u00A0']; private readonly string lineText; private readonly string trimmedLineText;