Commit Graph

459 Commits

Author SHA1 Message Date
Oliver Booth 07ea06b9be
Import Collections namespace 2022-04-22 09:27:03 +01:00
Oliver Booth 1598ffef99
Use Lerp for Random.NextDouble 2022-04-22 09:15:11 +01:00
Oliver Booth d5a74c12a8
Move Span.Any/All to Linq namespace (#7) 2022-04-22 08:50:06 +01:00
Oliver Booth 0fb01726db
Add tests for Enumerable/List 2022-04-21 22:35:06 +01:00
Oliver Booth 4096265006
Move LINQ-inspired methods to child namespaces (#7) 2022-04-21 22:27:24 +01:00
Oliver Booth 1d46ea6f9d
GenerateDocumentationFile in csproj 2022-04-21 22:09:04 +01:00
Oliver Booth d2bb7babe7
Pack CHANGELOG.md 2022-04-21 22:08:04 +01:00
Oliver Booth a1a30ffc3d
[ci skip] Format csproj (again) 2022-04-21 22:07:52 +01:00
Oliver Booth fb87395841
Remove reference to System.Runtime.Experimental 2022-04-21 22:07:09 +01:00
Oliver Booth 57b92a557e
Add IPAddress.IsIpv4/6 2022-04-21 21:52:37 +01:00
Oliver Booth 07126575a3
Don't bother adding overflowed long 2022-04-21 21:23:49 +01:00
Oliver Booth 671c08d2e2
Null check endPoint (#42) 2022-04-21 21:07:47 +01:00
Oliver Booth a1722e4374
Add time-related extension methods 2022-04-21 20:54:17 +01:00
Oliver Booth 8683bd79fa
[ci skip] Format Endianess enum 2022-04-21 19:56:32 +01:00
Oliver Booth 20c438b807
[ci skip] Remove trailing whitespaces 2022-04-21 19:53:59 +01:00
Oliver Booth 47bd3e1274
Move MathUtility to Math namespace (#7) 2022-04-21 19:18:36 +01:00
Oliver Booth ba7c88ccff
Rename MathUtils to MathUtility 2022-04-21 19:17:51 +01:00
Oliver Booth 0af2c7fb8e
Move Math/Numerics float extensions to child namespaces (#7) 2022-04-21 18:13:20 +01:00
Oliver Booth c8d8e212e2
Move EndPointExtensions to Net namespace (#7) 2022-04-21 17:46:41 +01:00
Oliver Booth 95020e0db0
Move math-related extensions to child namespace (#7) 2022-04-21 17:43:56 +01:00
Oliver Booth 95d61eff2c
Move RandomExtensions to child namespaces (#7) 2022-04-21 17:40:50 +01:00
Oliver Booth 44c8b87069
Added DigitalRoot for short/int/long
Also introduces Mod for short/long
2022-04-21 17:25:59 +01:00
Oliver Booth 881ccb0474
Added To extension method (equivalent of Enumerable.Range) 2022-04-21 17:22:29 +01:00
Oliver Booth 28551f25e6
Add trigonometric functions (implements #49) 2022-04-21 17:09:16 +01:00
Oliver Booth 8008a4a9ef
Fix incorrect return values for ComplexSqrt 2022-04-21 12:44:40 +01:00
Oliver Booth fb50d3832e
Remove unnecessary partial for BooleanExtensions 2022-04-21 12:27:13 +01:00
Oliver Booth 70b3e9eff3
Improve accuracy of ComplexSqrt 2022-04-21 12:26:13 +01:00
Oliver Booth e7e8d75fba
Rework Sqrt methods
Implemented using a method invented by Isaac Newton, authored by SLenik on StackOverflow CC-BY-SA 3.0 https://stackoverflow.com/a/6755197/1467293
2022-04-21 12:21:38 +01:00
Oliver Booth 6f96ab795c
Add Sqrt and ComplexSqrt for float/double 2022-04-21 12:06:18 +01:00
Oliver Booth b3a4342c77
[ci skip] Document ArithmeticException (#15) 2022-04-21 12:04:17 +01:00
Oliver Booth f6c08fedf3
Cast directly to long, not short, for IsPrime 2022-04-21 11:49:21 +01:00
Oliver Booth 86b6a94adc
Add Sign() for signed numeric types
Behaves as Math.Sign()
2022-04-21 11:04:05 +01:00
Oliver Booth 3a58ed88c9
Add AsArray/AsEnumerable (#47) 2022-04-20 23:14:16 +01:00
Oliver Booth 1460e6b6c3
Add LINQ-inspired All/Any for ReadOnly/Span<T> 2022-04-20 19:33:51 +01:00
Oliver Booth 85becd2415
Add Array.Fill 2022-04-20 19:27:06 +01:00
Oliver Booth e183c31579
Add Array.AsReadOnly and Array.Clear
Tests were added, implementation was missing
2022-04-20 19:24:42 +01:00
Oliver Booth 108390a415
Allow null alternative 2022-04-20 19:19:07 +01:00
Oliver Booth d4e3c8ab50
Use file-scoped namespaces 2022-04-20 18:51:20 +01:00
Oliver Booth 37c7b74379
Inline float arithmetic, don't cast 2022-04-20 18:50:06 +01:00
Oliver Booth 00571983c6
Force precedence of constant arithemtic
(Relates to previous commit, forgot doubles. Leave me alone)
2022-04-20 18:39:13 +01:00
Oliver Booth 8f40dd8617
Force precedence of constant arithmetic 2022-04-20 18:37:02 +01:00
Oliver Booth 1fc22cc99c
Fix RadiansToDegrees formula 2022-04-20 18:36:16 +01:00
Oliver Booth b107360190
Use MathF.PI instead of Math.PI with cast 2022-04-20 18:34:49 +01:00
Oliver Booth facc0834f0
Separate unwrapped Enum.Next/Previous to Unchecked overloads 2022-04-20 18:16:59 +01:00
Oliver Booth d9b60fbb94
Optimize debug builds 2022-04-20 17:35:56 +01:00
Oliver Booth 2a6df446c2
[ci skip] Format csproj 2022-04-20 17:35:21 +01:00
Oliver Booth 4c81c218d5
Remove preview features 2022-04-20 17:34:49 +01:00
Oliver Booth 928fa64ba4
Remove Random.NextInt64
This functionality is built in starting with .NET 6
2022-04-20 17:17:49 +01:00
Oliver Booth ea08d0fb9e
[ci skip] Use meaningful parameter names (#14) 2022-04-20 17:11:55 +01:00
Oliver Booth 1c9bb0d82e
[ci skip] Order methods lexicographically 2022-04-20 17:10:40 +01:00
Oliver Booth ed17ce175a
Use improved wording in xmldoc (#15) 2022-04-20 17:05:21 +01:00
Oliver Booth 6e1f08472d
null-check Random parameter (#42) 2022-04-20 17:04:37 +01:00
Oliver Booth 244f079133
Favour string.IsNullOrWhiteSpace over Length == 0 (#42) 2022-04-20 17:03:32 +01:00
Oliver Booth b6ec67d91f
Remove internal Random in favour of static Shared 2022-04-20 17:02:35 +01:00
Oliver Booth 684fba043f
Remove IReadOnlyCollection<T>.Split
In the same vein as 0123ec60d6
2022-04-20 16:52:07 +01:00
Oliver Booth c4b82c2619
[ci skip] Fix xmldoc for Shuffle/Shuffled (#15) 2022-04-20 16:46:02 +01:00
Oliver Booth 66e7e79561
Rename Clusivity enum to InclusiveOptions
https://sonarcloud.io/project/issues?fileUuids=AX9gUgFivY1Q2LeuiUva&pullRequest=43&id=oliverbooth_X10D&open=AX75E353Zn_cGN5aPZcQ
2022-04-20 16:35:44 +01:00
Oliver Booth 5b5fa42b46
[ci skip] Rename Clusivity.Exclusive to Clusivity.None
https://sonarcloud.io/project/issues?fileUuids=AX9gUgFivY1Q2LeuiUva&pullRequest=43&id=oliverbooth_X10D&open=AX75E353Zn_cGN5aPZcR
2022-04-20 16:33:11 +01:00
Oliver Booth d8877a293e
[ci skip] Initialize Clusivity fields with explicit flag values
https://sonarcloud.io/project/issues?fileUuids=AX9gUgFivY1Q2LeuiUva&pullRequest=43&id=oliverbooth_X10D&open=AX75E353Zn_cGN5aPZcR
2022-04-20 16:31:33 +01:00
Oliver Booth 0123ec60d6
Remove IEnumerable<T>.Split(int)
This functionality has been introduced in .NET 6 with the Chunk method: https://docs.microsoft.com/en-us/dotnet/api/system.linq.enumerable.chunk?view=net-6.0
2022-04-20 16:26:15 +01:00
Oliver Booth 524f3ff092
Remove redundant throw of FileNotFoundException
OpenRead constructs a FileStream, this constructor throws the same exception
2022-04-20 15:35:09 +01:00
Oliver Booth acf57bdfd6
[ci skip] Fix grammar in xmldoc (#15) 2022-04-20 15:20:01 +01:00
Oliver Booth 91b43790b3
Add selector parameter for key, value, or both (resolves #3)
Allows caller to specify a transformation to apply to key/value, presumably when either (or both) do not have an intended result of ToString
2022-04-20 15:17:33 +01:00
Oliver Booth 2325c45d84
[ci skip] Fix method naming, rewrite xmldoc (#14) (#15)
Uses coherent nullablility contract
2022-04-20 15:08:31 +01:00
Oliver Booth e3af2ce91d
Join GET query with & not ; (fixes #48) 2022-04-20 14:56:00 +01:00
Oliver Booth 9bfb78a1d6
[ci skip] Ignore folders as namespace providers (#41) 2022-04-20 14:36:53 +01:00
Oliver Booth 0e63c3a107
Clarify xmldoc for GetHash 2022-04-20 14:32:48 +01:00
Oliver Booth 374933e45e
Add FileInfo.GetHash<T>
Wraps Stream.GetHash<T>, but saves the caller having to OpenRead themselves
2022-04-20 14:29:45 +01:00
Oliver Booth 5168948a1d
Use generic Enum.GetValues 2022-04-20 14:09:13 +01:00
Oliver Booth 3c60340bde
Add Product extension method
Computes the element-wise product, optionally with a transformation delegate
2022-04-20 14:07:16 +01:00
Oliver Booth 1b1556b7bb
Add StringBuilderReader
Implements a TextReader which reads from a StringBuilder, allowing consumers to iterate through it without consuming the result of StringBuilder.ToString()
2022-04-20 13:08:51 +01:00
Oliver Booth cfa2eb7fa6
Use automatic versioning 2022-04-20 12:18:40 +01:00
Oliver Booth 4f99763a0a
Remove string.WithAlternative
Yeah... so I already had this method which accepted a bool, forgot about that.

But now it's separated into more meaningfully-named methods. So...

https://www.youtube.com/watch?v=oJimiVFCjJ0
2022-03-06 17:32:53 +00:00
Oliver Booth 45804c2da6
Add string.With*Alternative
Serves as a way to specify a custom alternative in cases where AsNullIf* does not satisfy
2022-03-06 17:31:22 +00:00
Oliver Booth c151a9c754
(#42) throw on null value for string.Base64*code 2022-03-06 17:29:26 +00:00
Oliver Booth 3e11a209e7
(#15) Remove "Returns" from <returns> for string.Repeat 2022-03-06 17:28:12 +00:00
Oliver Booth b2cf22efdf
(#15) Improve xmldoc for string.AsNullIfEmpty/WhiteSpace 2022-03-06 17:27:31 +00:00
Oliver Booth 191cbbe97c (#45) Use file-scoped namespaces 2022-02-14 16:42:49 +00:00
Oliver Booth c014b7d410 (#14) Use explicit type
Use implicit using
2022-02-14 16:32:30 +00:00
Oliver Booth 64bcb34a11 Introduce Between clusivity 2022-02-14 16:24:14 +00:00
Oliver Booth 0e8af01a9d Remove bool->unsigned methods 2022-02-14 16:03:38 +00:00
Oliver Booth 334e706b68 (#46) Add string.IsPalindrome 2022-02-14 15:57:29 +00:00
Oliver Booth 7fd1b88acf (#14) Use explicit type 2022-02-14 15:53:50 +00:00
Oliver Booth 7c05af1fde Remove To/From boolean methods
Consumers should cast to IConvertible and call already-existing method
2022-02-14 15:52:03 +00:00
Oliver Booth a8087771c8 Swap via deconstruction 2022-02-14 15:45:52 +00:00
Oliver Booth a73ec546d1 (#14) Use explicit type where non-evident 2022-02-14 15:45:28 +00:00
Oliver Booth 3a42b4cac9 Format csproj 2022-02-14 13:02:30 +00:00
Oliver Booth b139d06a33 Remove FxCop in favour of built in analyzer 2022-02-14 12:59:41 +00:00
Oliver Booth a47bcbeaa8 Bump FxCop to 3.3.2 2022-02-14 12:21:55 +00:00
Oliver Booth 5ec4e06d9d (#15) Improve xmldoc bool returns
Changed ",or false otherwise" to "; otherwise, false."
2022-02-14 12:07:30 +00:00
Oliver Booth 64cadbe87d Use implicit usings in BooleanExtensions.Unsigned.cs 2022-02-14 12:02:22 +00:00
Oliver Booth 920750a207 Enable implicit usings 2022-02-14 12:00:37 +00:00
Oliver Booth 14a0f2fdd4 Enable preview features
System.Runtime.Experimental preview added as private dependency
2022-02-13 23:33:31 +00:00
Oliver Booth 2193e6b92c (#43) (#45) Bump to .NET 6 / C# 10 2022-02-13 23:32:04 +00:00
Oliver Booth 803032a567 Add int.Mod(int) and circular shifting 2022-02-13 19:40:38 +00:00
Oliver Booth 7a0aae3bd5
Use bit check rather than modulo for IsEven 2021-08-31 15:49:43 +01:00
Oliver Booth 0bafb64ecb
(#15) Fix typo in short.IsEven xmldoc 2021-08-31 15:48:40 +01:00
Oliver Booth 1ee5b8ef64
(#14) Use explicit type (#42) Ensure readable stream 2021-08-31 15:47:12 +01:00
Oliver Booth f268cf5b02
(#44) Replace string.Randomize overloads with optional parameter 2021-07-20 17:32:05 +01:00
Oliver Booth 4bf295a028
Call generic Enum.Parse<T> for .NET >= 5 2021-07-20 17:29:57 +01:00
Oliver Booth 3bbf689db4
Add Enum constraint to string.EnumParse<T> 2021-07-20 17:29:26 +01:00
Oliver Booth af3dfaa623
(#14) Pattern-match IsEnum property on typeof(T) 2021-07-20 17:25:52 +01:00
Oliver Booth 3d44132865
Use double parameter for double.ToBoolean 2021-07-20 17:20:35 +01:00
Oliver Booth 45eb0ef415
Add IReadOnlyCollection<T>.Split(int)
Yields the same results as IEnumerable<T>.Split(int), except is able to
avoid a hidden allocation with the benefit of knowing the collection
size ahead of time
2021-07-20 17:18:15 +01:00
Oliver Booth d6e8471239
Lazily enumerate source enumerable
Don't consume with ToArray() before iterating and yielding results back. This decreases allocations
2021-07-20 17:15:10 +01:00
Oliver Booth 35a9b31be7
(#14) Import System to avoid Random FQN 2021-07-20 17:12:28 +01:00
Oliver Booth 9a26031245
(#15) Document possible ArgumentOutOfRangeException 2021-07-20 17:01:30 +01:00
Oliver Booth 78830a3b9e
Move Lerp implementation to MathUtils class
float/double/short/int/long methods call MathUtils class
2021-07-20 16:56:56 +01:00
Oliver Booth ac203dda1f
(#14) Perform solution-wide code cleanup 2021-07-20 16:46:51 +01:00
Oliver Booth b81cac03d6
Add CultureInfo argument to exception message format 2021-07-20 16:24:16 +01:00
Oliver Booth f0e3b65604
Delegate (s)byte.IsPrime to short.isPrime 2021-07-20 14:26:23 +01:00
Oliver Booth f20aa3dbd4
(#41) Ignore directories as namespace providers 2021-07-20 14:01:33 +01:00
Oliver Booth 25a40521c8
(#42) Short circuit char.Repeat count 0 and 1 2021-07-20 01:02:02 +01:00
Oliver Booth 7192b46e9f
(#15) Format xmldoc for byte extensions 2021-07-20 00:51:27 +01:00
Oliver Booth 6722c0185e
Delegate byte prime check to int 2021-07-20 00:50:10 +01:00
Oliver Booth 0197d89e48
(#14) (#15) Code cleanup on bool xmldoc 2021-07-19 12:45:54 +01:00
Oliver Booth 6e4a9882e9
(#32) Add (short/int/long).To(Host/Network)Order
Implementation calls IPAddress.(Host/Network)To(Network/Host)Order
2021-07-19 11:46:38 +01:00
Oliver Booth 61c122c9ea
(#42) Throw exceptions on invalid string arguments 2021-07-19 11:39:08 +01:00
Oliver Booth 92d60a6db8
(#42) Use NRT for AddNullIf__ 2021-07-19 11:38:24 +01:00
Oliver Booth 14b43adf82
(#27) Add "count must be >= 0" message 2021-07-19 11:35:23 +01:00
Oliver Booth 55dc20b79d
(#14) Format csproj 2021-07-19 11:34:37 +01:00
Oliver Booth c91067a9ba (#15) Add xmldoc to Endianness enum fields 2021-06-27 13:19:55 +01:00
Oliver Booth e2e7b3a947 (#42) Validate not-null values 2021-06-27 13:15:21 +01:00
Oliver Booth d6f4a96257 (#42) Validate lower <= upper 2021-06-27 13:14:42 +01:00
Oliver Booth 370f2d96f4 (#42) Validate not-null value 2021-06-27 13:14:11 +01:00
Oliver Booth e3d38a633d (#42) Validate count >=0 2021-06-27 13:11:03 +01:00
Oliver Booth e8ef1cd028 Return Task<bool> for WaitHandle.WaitOneAsync 2021-06-27 13:08:58 +01:00
Oliver Booth 4828300076 (#42) Validate not-null handle 2021-06-27 13:06:17 +01:00
Oliver Booth 49ed44100d (#41) Remove child namespaces 2021-06-27 12:31:04 +01:00
Oliver Booth 9d3f2b263f (#15) Rewrite summary for IComparable.Between 2021-04-06 11:06:43 +01:00
Oliver Booth c6f550d5a7 (#27) Move bounds exception to resource 2021-04-02 12:40:55 +01:00
Oliver Booth b36638d4df (#15) Unsigned are in signed namespace 2021-04-02 12:14:33 +01:00
Oliver Booth 6e0255f6cf Use explicit narrowing conversion 2021-04-02 12:11:01 +01:00
Oliver Booth 9e193e7142 Add ByteExtensions and SByteExtensions 2021-04-01 13:34:30 +01:00
Oliver Booth a8de6e1755 Refactor TimeSpanParse.Parse to .TryParse
Exception will no longer be thrown
2021-04-01 10:32:33 +01:00
Oliver Booth 27a370cffe Add float/double.ToBoolean 2021-03-16 15:02:41 +00:00
Oliver Booth 1ee7e59f91 (#38) Add short/int/long.Lerp 2021-03-16 14:46:49 +00:00
Oliver Booth c3cb8ba261 (#14) Enforce 130-char line length 2021-03-16 14:42:33 +00:00
Oliver Booth 4571697589 (#15) (#39) Match unsigned impl with signed 2021-03-12 13:24:30 +00:00
Oliver Booth cb40ecb22c (#15) Add usage example for bool.GetBytes 2021-03-12 13:19:52 +00:00
Oliver Booth 84706fe54b (#15) Add seealso in xmldoc 2021-03-12 13:19:31 +00:00
Oliver Booth 9b79d216f8 (#15) One-line WriteLine arguments for example 2021-03-12 12:04:51 +00:00
Oliver Booth 5dab9323b6 (#39) Use inline ternary instead of cast 2021-03-12 12:03:30 +00:00
Oliver Booth ef78f86b3a (#15) Add spacing between text and code for example 2021-03-12 12:02:26 +00:00
Oliver Booth 1dca7064d0 One-line returns node for xmldoc 2021-03-12 11:55:46 +00:00
Oliver Booth 49c037391a Fix return type on bool.ToDouble 2021-03-12 11:53:08 +00:00
Oliver Booth 8ddf3dfc30 (#14) Remove whitespace from empty lines 2021-03-12 11:28:19 +00:00
Oliver Booth db790920aa One-line example WriteLine invocation 2021-03-11 16:54:58 +00:00
Oliver Booth 4a88358f47 Internalise LerpInternal method 2021-03-11 16:46:02 +00:00
Oliver Booth 688058a7aa (#39) Explictly implement Lerp 2021-03-11 16:45:18 +00:00