Hello I have this LINQ statement. I want to know if anyone sees a way to simplify it so I do not have to get a list then take from that list a random record
Random rand = new Random();
var AdList =
(from a in Advertisements
join c in Companies on a.AdvertiementOwnerID equals c.CompanyID
where a.AdvertisementType=="Banner"
select new {
a.AdvertisementID,
a.AdvertisementType,
a.AdvertiementActive,
a.AdvertisementText,
a.AdvertisementImageLocation,
a.AdvertisementAlt,
c.CompanyName,
c.Website }
).ToList(); <-- would like to do all here
int toSkip = rand.Next(0, AdList.Count); problem here do not know how to get count in above list and use it as random Max val
var AdList2 = AdList.Skip(toSkip).Take(1);
AdList2.Dump(); // LINQPad dumps