Is there an equivalent for ActiveRecord#find_by equivalent for C#?
- by Benjamin Manns
I'm originally a C# developer (as a hobby), but as of late I have been digging into Ruby on Rails and I am really enjoying it. Right now I am building an application in C# and I was wondering if there is any collection implementation for C# that could match (or "semi-match") the find_by method of ActiveRecord.
What I am essentially looking for is a list that would hold Rectangles:
class Rectangle
{
public int Width { get; set; }
public int Height { get; set; }
public String Name { get; set; }
}
Where I could query this list and find all entries with Height = 10, Width = 20, or name = "Block". This was done with ActiveRecord by doing a call similar to Rectangle.find_by_name('Block'). The only way I can think of doing this in C# is to create my own list implementation and iterate through each item manually checking each item against the criteria. I fear I would be reinventing the wheel (and one of poorer quality).
Any input or suggestions is much appreciated.