Reputation: 3032
I have simple class:
class MyClass
{
public Guid Guid { get; set; }
}
I have myClasses
query that contains one item: new MyClass() { Guid = Guid.NewGuid() }
I'm trying to select Guid property from query :
var result = myClasses.Select($"new(Guid)");
But it is showing following exception:
System.Linq.Dynamic.ParseException: ''.' or '(' expected'
It seems Dynamic linq
is mixing up my Guid
property with System.Guid
structure. How can I solve this issue?
Note: It works when I rename property
Upvotes: 1
Views: 307
Reputation: 9830
When using System.Linq.Dynamic.Core, you have 2 options:
var result = myClasses.Select($"new(it.Guid)");
var result = myClasses.Select($"new(@Guid)");
Upvotes: 1