I have a class MyClass
with a method:
public bool MyMethod(out DateTime? MyDate) {
...
}
I'd like to call this method in the following way:
var q = from mc in MyClasses.AsEnumerable()
from output in mc.MyMethod(out dt) // how to declare dt?
select new { mc, output, dt };
Obviously this doesn't compile, coz I haven't declared dt
. I can declare it outside the query, but that doesn't give me a warm fuzzy feeling: (a) I don't like declaring variables at a level greater than the necessary scope, and (b) it isn't immediately and intuitively obvious that the value would be calculated correctly for each row inside the query.
Is there some syntax that will allow me to declare DateTime? dt
inside the query?