views:

22

answers:

1

I would like to select from a table using linq to sql without knowing what that table is until runtime, something like

Type t = Type.GetType(myString);
var results = from o in context.t select o;

Obviously this doesn't work, but I was wondering if there was a way to do this.

+2  A: 

Well, you can use DataContext.GetTable(Type). That returns an ITable. Without knowing more about what you're trying to do, that's the closest we can really come to answering... if you can give more detail, we may be able to help you more.

Jon Skeet
Yea, sorry for being an idiot. I hadn't referenced the System.data.linq assembly yet in my WCF project, so I was only getting table names as properties off my context instantiation and wasn't thinking clearly to realize my intellisense wasn't showing everything. Thanks for the response.
sonicblis