Querying similar to C#