Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
StefH committed Aug 15, 2024
1 parent d1d3cc6 commit 483d332
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions src-blazor/WasmDynamicLinq/Pages/Home.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,13 @@ protected override void OnInitialized()
.Select("new (OrderId as Id, OrderItems.Where(w => true) as Children, null as Empty)")
.ToDynamicList<DynamicClass>();

//allOrderItemsDynamic = new List<dynamic>(orders.Select(s => new { Id = s.OrderId, Children = s.OrderItems }));

foreach (var element in allOrderItemsDynamic)
{
object elementAsObj = element;

//works
var idReflection = elementAsObj.GetType().GetProperty("Id").GetValue(elementAsObj);
var idReflection = elementAsObj.GetType().GetProperty("Id")!.GetValue(elementAsObj);
Console.WriteLine("idReflection = " + idReflection);

//fails
Console.WriteLine("dynamic = " + element["Id"]);
}
}
Expand Down

0 comments on commit 483d332

Please sign in to comment.