I'm using C# 3.5 and am currently using Linq to get all users from a user table and put them in a list.
C# 3.5
Linq
Now I would like to return a random user from that list. What's the best way to go about doing that?
Edit: Found it here: How to get a Random Object using Linq
Like this:
var rand = new Random(); var user = users[rand.Next(users.Count)];
1.4m articles
1.4m replys
5 comments
57.0k users