Languages
[Edit]
EN

C# / .NET - pick random string from array of strings

2 points
Created by:
Root-ssh
178290

In C# / .NET it is possible to get element with [ ] operator or IEnumerable<TSource>.ElementAt method. To get random element, random index from Random class is necessary.

1. Random index example

Edit

Output:

References

Edit
  1. Random.Next Method - Microsoft Docs
  2. Enumerable.ElementAt Method - Microsoft Docs

Alternative titles

  1. C# / .NET - pick random text from array of texts
1
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.

C# / .NET - random

Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join