You can use anonymous types for this, i.e.:
var pageObject = (from op in db.ObjectPermissions join pg in db.Pages on op.ObjectPermissionName equals page.PageName where pg.PageID == page.PageID select new { pg, op }).SingleOrDefault();
This will make pageObject an IEnumerable of anonymous type, so AFAIK you will not be able to pass it to other methods, however, if you just get the data to play in the method that you are using now perfectly. You can also name properties in your anonymous type, that is: -
var pageObject = (from op in db.ObjectPermissions join pg in db.Pages on op.ObjectPermissionName equals page.PageName where pg.PageID == page.PageID select new { PermissionName = pg, ObjectPermission = op }).SingleOrDefault();
This will let you say: -
if (pageObject.PermissionName.FooBar == "golden goose") Application.Exit();
For example: -)
ljs Aug 28 '08 at 14:46 2008-08-28 14:46
source share