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:
@@ -118,7 +118,7 @@ else
|
||||
{
|
||||
if (!_fieldIdToCareers.ContainsKey(field.Id))
|
||||
{
|
||||
_fieldIdToCareers[field.Id] = new List<string>();
|
||||
_fieldIdToCareers[field.Id] = [];
|
||||
}
|
||||
// Add unique career names for this field
|
||||
foreach (var career in evt.RelatedCareers)
|
||||
@@ -153,8 +153,8 @@ else
|
||||
|
||||
private NetworkData GenerateNetworkData(List<EventDefinition> events)
|
||||
{
|
||||
var nodes = new List<Node>();
|
||||
var edges = new List<Edge>();
|
||||
List<Node> nodes = [];
|
||||
List<Edge> edges = [];
|
||||
|
||||
// Dictionary to track node IDs (to avoid duplicates)
|
||||
var eventNodeIds = new Dictionary<int, string>();
|
||||
@@ -284,7 +284,7 @@ else
|
||||
Title = field.Name,
|
||||
Description = field.Description,
|
||||
IsCareerField = true,
|
||||
Careers = careers?.ToList() ?? new List<string>()
|
||||
Careers = careers?.ToList() ?? []
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user