Skip to content

Commit 655bb47

Browse files
gkaletajkordick
authored andcommitted
fix: use Cast<dynamic>() instead of inner cast in dependency graph loop
Replaces foreach+inner cast pattern with edges.Cast<dynamic>() for cleaner iteration. Adds System.Linq using. Resolves github-code-quality note on PR #22.
1 parent 6513030 commit 655bb47

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

McpChatWeb/Program.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System.IO;
2+
using System.Linq;
23
using System.Text.Json;
34
using System.Text.Json.Nodes;
45
using Microsoft.AspNetCore.Builder;
@@ -906,11 +907,10 @@ async Task<IResult> BuildGraphFromSqliteAsync(int? requestedRunId, bool includeI
906907
if (includeInferredNodes)
907908
{
908909
var nodeMap = nodes.ToDictionary(n => (string)((dynamic)n).id, n => n);
909-
foreach (var edge in edges)
910+
foreach (dynamic edge in edges.Cast<dynamic>())
910911
{
911-
var e = (dynamic)edge;
912-
var sourceId = (string)e.source;
913-
var targetId = (string)e.target;
912+
var sourceId = (string)edge.source;
913+
var targetId = (string)edge.target;
914914

915915
if (!nodeMap.ContainsKey(sourceId))
916916
{

0 commit comments

Comments
 (0)