Get a Random Record in C# with LinQ

1
2
Random rand = new Random();
int toSkip = rand.Next(0, db.Post.Count());
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
I Have an Entity called "Post" so I get a random record in the database with this query.

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.