I want to go from
var selectData = (from i in data
where i.Name == "Bob1"
select i);
To
var selectData = (from i in data
select i).Where("Name==Bob1");
I've tried various approaches (AsQueryable
, Where<SomeData>
), but can't get the second form to compile.
I do not have a good grasp on C#'s generic extension methods. The <Tsource>
doesn't make sense to me so that could be the problem. Also, I do not understand why I can type .Where()
when intellisense only displays .Where<>
(a generic). I expect to see a second Where
without the generic symbol...alas I do not.
Class
public class SomeData
{
public string Name { get; set; }
public string Address { get; set; }
}
UPDATE
There appears to be some confusion as to how Where() can be used that may well be my fault. Please see a related question. Based off this answer, the property name in the where clause is perfectly legal. I need the property to remain a string. If that means dynamic LINQ is required, then so be it...that's what I need.