OMG. That hits the mark in sooo many ways. The power of this is mind blowing. Anders (et al) rocks. Hats off to C9 also. You promised this last time and you did it! It amazing to think of the work that went on between then and now to get those bits ready. Anders must have been further along then he let on last time.
BTW, what was the "var" class (i.e. "var q = new...")? I expect the Monad folks wish they had this a year ago. I suppose they must shred this into their code now for all the object query stuff they do.
Now all anyone has to do is implement an LINQ Object Provider (LOP) around their data and Bingo, instant user query access.
Hmm...: fat, ntfs, AD, exchange, winfs, machine config, registry, perf counters, net config, hardware info. The list is endless.
Something like this would be way cool to be able to do some day:
var q = From Microsoft.LINQProviders.AD
Select WindowsIdentity
Where Username == "billg" && Domain == "MS"
WindowsIdentity wi = (WindowsIdentity)q[0];
WindowsPrinciple wp = new WindowsPrinciple(wi);
if ( wp.TryLogon("password") )
Console.WriteLine("Logon good.");
else
{
Console.WriteLine("Could not authenticate.");
return false;
}
Console.WriteLine("billg is an Admin:"+wp.IsInRole("Admins"));
using(Impersonate i = new Impersonate(wp))
{
File.Delete(@"c:\Linix\*.*"); // 
}Very cool indeed. Pizza and beer for the team!

--William Stacey [MVP]