It depends on the scope for what you need this "type" for.
If you only need access to this result in a particular method, you can project the result into an anonymous type (as they only have method scope).
Example:
var result = (from a in tablea join b in tableb
on a.key equals b.key
select new {
PropertyOne = a.Something,
PropertyTwo = b.Something
}).SingleOrDefault();
In that example, result will be an anonymous type, containing two properties, PropertyOne and PropertyTwo.
Note, before calling SingleOrDefault, the query is an IQueryable<T>
, so you can choose to project the result set into a collection, by using .ToList()
.
Modify the select new (called 'projection') to contain whatever you want.
If you need access to this type outside the method, instead of select new { }
, do this:
select new SomeClass { ... } // projection into concrete class
And project the fields into that class (which can have the appropriate accessibility modifier).
Also (on a side note), please don't forget to go back and accept some of your answers (including this one, if it's correct), as it will result in more people providing you with assistance.
HTH