I am trying to get a random object within linq. Here is how I did.
//get all the answers
var Answers = q.Skip(1).Take(int.MaxValue);
//get the random number
I have product table in database ,every time user enters one product detail I want to show 10 similar products in below of page.And in every refresh this list must be change .it must come randomly.
Linq looks like this
var products =
DataContextFactory.GetDataContext()
.Set()
.Where(x =>x.Id!=id)
.OrderBy(emp => Guid.NewGuid())
.Take(10).ToList();
x.Id!=id
this only for not put selected product to list .
It works perfect