aboutsummaryrefslogtreecommitdiffstats
path: root/src/IOL.Helpers/RandomStringGenerator.cs
diff options
context:
space:
mode:
authorivarlovlie <git@ivarlovlie.no>2021-11-20 21:31:30 +0100
committerivarlovlie <git@ivarlovlie.no>2021-11-20 21:31:30 +0100
commit7ff7f3902e5bdcc33bfc07fa6ad71a5798d7f8d6 (patch)
tree6e7eaaed636558c4feb88f2bb18bbb7d4c0c87be /src/IOL.Helpers/RandomStringGenerator.cs
parent4e41b1f31a7309b299398fd9dd53d499204fa6cf (diff)
downloaddotnet-helpers-7ff7f3902e5bdcc33bfc07fa6ad71a5798d7f8d6.tar.xz
dotnet-helpers-7ff7f3902e5bdcc33bfc07fa6ad71a5798d7f8d6.zip
Change to file-scoped namespaces.
Add ConditionalWhere to QueryableHelpers.cs
Diffstat (limited to 'src/IOL.Helpers/RandomStringGenerator.cs')
-rw-r--r--src/IOL.Helpers/RandomStringGenerator.cs19
1 files changed, 9 insertions, 10 deletions
diff --git a/src/IOL.Helpers/RandomStringGenerator.cs b/src/IOL.Helpers/RandomStringGenerator.cs
index 0d691db..2f39d67 100644
--- a/src/IOL.Helpers/RandomStringGenerator.cs
+++ b/src/IOL.Helpers/RandomStringGenerator.cs
@@ -1,18 +1,17 @@
using System;
using System.Linq;
-namespace IOL.Helpers
+namespace IOL.Helpers;
+
+public static class RandomString
{
- public static class RandomString
- {
- private static readonly Random _random = new Random();
+ private static readonly Random _random = new();
- public static string Generate(int length, bool numeric = false) {
- var chars = numeric switch {
+ public static string Generate(int length, bool numeric = false) {
+ var chars = numeric switch {
false => "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",
true => "0123456789"
- };
- return new string(Enumerable.Repeat(chars, length).Select(s => s[_random.Next(s.Length)]).ToArray());
- }
+ };
+ return new string(Enumerable.Repeat(chars, length).Select(s => s[_random.Next(s.Length)]).ToArray());
}
-} \ No newline at end of file
+}