Refactor collection initializers to use C# 12 collection expressions
This commit updates various files across the Core and WebApp projects to replace traditional collection initializers with C# 12 collection expressions. Changes include modifications to EventAssignment.cs, TeamScheduler_DecisionTree.cs, CareerField.cs, EventDefinition.cs, and several components in the WebApp. These updates enhance code readability and maintainability by adhering to modern C# syntax standards.
This commit is contained in:
@@ -14,11 +14,11 @@ public static class EventOccurrenceGrammar
|
||||
/// Array of all month names in order (January through December).
|
||||
/// This is the single source of truth for month names used throughout the parser.
|
||||
/// </summary>
|
||||
public static readonly string[] MonthNames = new[]
|
||||
{
|
||||
public static readonly string[] MonthNames =
|
||||
[
|
||||
"January", "February", "March", "April", "May", "June",
|
||||
"July", "August", "September", "October", "November", "December"
|
||||
};
|
||||
];
|
||||
|
||||
// Build month parsers dynamically from MonthNames array
|
||||
private static readonly Parser<string>[] MonthParsers = MonthNames
|
||||
|
||||
@@ -27,7 +27,7 @@ public class StudentEventRankingParser : CsvParserBase
|
||||
continue;
|
||||
|
||||
|
||||
var competitiveEvents = new List<EventDefinition>(6);
|
||||
var competitiveEvents = new List<EventDefinition>();
|
||||
|
||||
for (var i = 1; i <= 6; i++)
|
||||
{
|
||||
|
||||
@@ -13,7 +13,7 @@ public class StudentParser : CsvParserBase
|
||||
|
||||
public Student[] Parse()
|
||||
{
|
||||
var s = new List<Student>();
|
||||
var students = new List<Student>();
|
||||
|
||||
CsvReader.Read();
|
||||
CsvReader.ReadHeader();
|
||||
@@ -44,9 +44,9 @@ public class StudentParser : CsvParserBase
|
||||
RegionalId = regionalId,
|
||||
NationalId = nationalId
|
||||
};
|
||||
s.Add(student);
|
||||
students.Add(student);
|
||||
}
|
||||
|
||||
return s.ToArray();
|
||||
return students.ToArray();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user