# Changelog ## [3.0.0 (Unreleased)] ### Added - Added `StringBuilderReader` (inheriting `TextReader`) which allows reading from a `StringBuilder` without consuming the underlying string - Added extension methods for `System.Decimal` - Added `All` and `Any` for `Span` and `ReadOnlySpan`, mimicking the corresponding methods in `System.Linq` - Added time-related extension methods (`Ticks`, `Milliseconds`, `Seconds`, `Minutes`, `Hours`, `Days`, and `Weeks`) to all built-in numeric types - Added `TimeSpan.Ago()` and `TimeSpan.FromNow()` - Added `Factorial` extension method for built-in numeric types - Added `FileInfo.GetHash()` - Added `FileInfo.TryWriteHash(Span, out int)` - Added `IEnumerable.Product()` and `IEnumerable.Product(Func, TResult)` for all built-in numeric types, computing the product of all (transformed) elements - Added `IEnumerable.Shuffled([Random])`, which wraps `IList.Shuffle([Random])` and returns the result - Added `T.AsArray()` - Added `T.AsEnumerable()` - Added `T.ToJson([JsonSerializerOptions])` - Added `T[].AsReadOnly()` - Added `T[].Clear([Range])` and `T[].Clear(int, int)` - Added `T[].Fill(T)` and `T[].Fill(T, int, int)` - Added `Random.Next()` - Added `Random.NextDouble(double)` - Added `Random.NextDouble(double, double)` - Added `Random.NextSingle()` - Added `Random.NextSingle(float)` - Added `Random.NextSingle(float, float)` - Added `Random.NextInt64()` - Added `Random.NextInt64(long)` - Added `Random.NextInt64(long, long)` - Added `Random.NextColor()` - Added `Random.NextUnitVector2()` - Added `Random.NextUnitVector3()` - Added `Random.NextRotation()` - Added `Rune.Repeat(int)` - Added `bool.GetBytes()` - Added `byte.GetBytes()` - Added `byte.IsEven()` - Added `byte.IsOdd()` - Added `byte.IsPrime()` - Added `sbyte.IsEven()` - Added `sbyte.IsOdd()` - Added `sbyte.IsPrime()` - Added `sbyte.Sign()` - Added `decimal.Sign()` - Added `double.Acos()` - Added `double.Acosh()` - Added `double.Asin()` - Added `double.Asinh()` - Added `double.Atan()` - Added `double.Atanh()` - Added `double.ComplexSqrt()` - Added `double.Cos()` - Added `double.Cosh()` - Added `double.LerpFrom(double, double)` - Added `double.LerpTo(double, double)` - Added `double.LerpWith(double, double)` - Added `double.Sign()` - Added `double.Sin()` - Added `double.Sinh()` - Added `double.Sqrt()` - Added `double.Tan()` - Added `double.Tanh()` - Added `float.Acos()` - Added `float.Acosh()` - Added `float.Asin()` - Added `float.Asinh()` - Added `float.Atan()` - Added `float.Atanh()` - Added `float.ComplexSqrt()` - Added `float.Cos()` - Added `float.Cosh()` - Added `float.LerpFrom(float, float)` - Added `float.LerpTo(float, float)` - Added `float.LerpWith(float, float)` - Added `float.Sign()` - Added `float.Sin()` - Added `float.Sinh()` - Added `float.Sqrt()` - Added `float.Tan()` - Added `float.Tanh()` - Added `short.ToHostOrder()` - Added `short.LerpFrom(double, double)` - Added `short.LerpTo(double, double)` - Added `short.LerpWith(double, double)` - Added `short.LerpFrom(float, float)` - Added `short.LerpTo(float, float)` - Added `short.LerpWith(float, float)` - Added `short.Sign()` - Added `short.ToNetworkOrder()` - Added `short.To(short)` and `short.To(short, short)` - Added `int.LerpFrom(double, double)` - Added `int.LerpTo(double, double)` - Added `int.LerpWith(double, double)` - Added `int.LerpFrom(float, float)` - Added `int.LerpTo(float, float)` - Added `int.LerpWith(float, float)` - Added `int.Mod(int)` - Added `int.RotateLeft(int)` - Added `int.RotateRight(int)` - Added `int.Sign()` - Added `int.ToHostOrder()` - Added `int.ToNetworkOrder()` - Added `int.To(int)` and `int.To(int, int)` - Added `long.ToHostOrder()` - Added `long.LerpFrom(double, double)` - Added `long.LerpTo(double, double)` - Added `long.LerpWith(double, double)` - Added `long.LerpFrom(float, float)` - Added `long.LerpTo(float, float)` - Added `long.LerpWith(float, float)` - Added `long.Sign()` - Added `long.ToNetworkOrder()` - Added `long.To(long)` and `long.To(long, long)` - Added `IComparable.Clamp(T, T)` which supersedes `short.Clamp(short, short)`, `int.Clamp(int, int)`, and `long.Clamp(long, long)` - Added `IComparable.GreaterThan(T)` - Added `IComparable.GreaterOrEqualTo(T)` - Added `IComparable.LessThan(T)` - Added `IComparable.LessThanOrEqualTo(T)` - Added `IComparable.Max(T)` - Added `IComparable.Min(T)` - Added `IReadOnlyCollection.Split(int)` - Yields the same results as `IEnumerable.Split(int)`, except is able to avoid a hidden allocation with the benefit of knowing the collection size ahead of time - Added `Type.HasCustomAttribute()` and `Type.HasCustomAttribute(Type)` - Added `Type.Implements()` and `Type.Implements(Type)` - Added `Type.Inherits()` and `Type.Inherits(Type)` - Added `Type.SelectFromCustomAttribute()` - Added `DateTimeOffset` extensions which supersede `DateTime` extensions - Added `Endianness` enum - Added `Stream.GetHash()` - Added `Stream.TryWriteHash(Span, out int)` - Added `Stream.ReadInt16([Endian])` - Added `Stream.ReadInt32([Endian])` - Added `Stream.ReadInt64([Endian])` - Added `Stream.ReadUInt16([Endian])` - Added `Stream.ReadUInt32([Endian])` - Added `Stream.ReadUInt64([Endian])` - Added `Stream.Write(short, [Endian])` - Added `Stream.Write(int, [Endian])` - Added `Stream.Write(long, [Endian])` - Added `Stream.Write(ushort, [Endian])` - Added `Stream.Write(uint, [Endian])` - Added `Stream.Write(ulong, [Endian])` - Added `string.IsPalindrome()` - Added `string.FromJson([JsonSerializerOptions])` - Added `TimeSpanParser.TryParse` which supersedes `TimeSpanParser.Parse` ### Changed - Update to .NET 6 - Methods defined to accept `byte[]` have been changed accept `IReadOnlyList` - `Enum.Next([bool])` and `Enum.Previous([bool])` have been separated. Non-wrapped overloads now use the `Unchecked` prefix (`NextUnchecked` and `PreviousUnchecked`) - Improve performance for: - `string.IsLower()` - `string.IsUpper()` - `string.Reverse()` - `IEnumerable.Split(int)` now lazily enumerates, rather than consuming in full before yielding - Separated `short.FromUnixTimestamp(bool)` into `short.FromUnixTimeMilliseconds` and `short.FromUnixTimeSeconds` - Separated `int.FromUnixTimestamp(bool)` into `int.FromUnixTimeMilliseconds` and `int.FromUnixTimeSeconds` - Separated `long.FromUnixTimestamp(bool)` into `long.FromUnixTimeMilliseconds` and `long.FromUnixTimeSeconds` - Seperated `string.WithAlternative(string, [bool])` to `string.WithEmptyAlternative(string)` and `string.WithWhiteSpaceAlternative(string)` - `IComparable.Between` now accepts an `InclusiveOptions` parameter to specify whether checks shall be inclusive or exclusive - Renamed `Random.CoinToss()` to `Random.NextBoolean()` to fall into consistency with `Random.Next()`, `Random.NextBytes()` and `Random.NextDouble()` - Renamed `Random.OneOf()` to `Random.NextFrom()` (same reasoning) - Renamed `List.OneOf()` to `List.Random()` - Renamed `string.Random(int[, Random])` to `string.Randomize(int[, Random])` - Renamed `char[].Random(int)`, `char[].Random(int, Random)`, `IEnumerable.Random(int)`, and `IEnumerable.Random(int, Random)`, in favour of `Random.NextString(IReadOnlyList, int)` - `IList.Shuffle([Random])` now uses a Fisher-Yates shuffle implementation - `IList.Shuffle([Random])` now returns `void`, as it will reorganize the elements in-place on the current `IList` - `Dictionary`, `IDictionary`, and `IReadOnlyDictionary` extension methods have been consolidated to `IEnumerable>` - Fixed a bug where `IEnumerable>.ToConnectionString()` would not sanitize types with custom `ToString()` implementation (#20) - `DateTime` extensions now wrap `DateTimeOffset` extensions - `DateTime.ToUnixTimestamp([bool])` has been split into `DateTime.ToUnixTimeMilliseconds()` and `DateTime.ToUnixTimeSeconds()` - `IEnumerable.GetString([Encoding])` has been renamed to `IReadOnlyList.ToString` and its `Encoding` parameter has been made non-optional - `WaitHandle.WaitOneAsync` now returns `Task` as a result of calling `Task.Run`, rather than returning a typeless `new Task()` - `string.AsNullIfEmpty()` and `string.AsNullIfWhiteSpace()` now accept a nullable `string` - `string.WithAlternative` is now `string.WithEmptyAlternative` and `string.WithWhiteSpaceAlternative` ### Removed - Removed `bool.And(bool)` - Removed `bool.NAnd(bool)` - Removed `bool.NOr(bool)` - Removed `bool.Not()` - Removed `bool.Or(bool)` - Removed `bool.XNOr(bool)` - Removed `bool.XOr(bool)` - Removed `float.ToBoolean()` - Removed `double.ToBoolean()` - Removed `int.ToBoolean()` - Removed `long.ToBoolean()` - Removed `IConvertible.To([IFormatProvider])` - Removed `IConvertible.ToOrDefault([IFormatProvider])` - Removed `IConvertible.ToOrDefault(out T, [IFormatProvider])` - Removed `IConvertible.ToOrNull([IFormatProvider])` - Removed `IConvertible.ToOrNull(out T, [IFormatProvider])` - Removed `IConvertible.ToOrOther(T, [IFormatProvider])` - Removed `IConvertible.ToOrOther(T, out T, [IFormatProvider])` - Removed `IEnumerable.Split(int)` and `IReadOnlyCollection.Split` (this functionality is now provided by LINQ in the form of the [`Chunk`](https://docs.microsoft.com/en-us/dotnet/api/system.linq.enumerable.chunk?view=net-6.0) method) - Removed `MemberInfo.GetDefaultValue()` (use `SelectFromCustomAttribute()` instead) - Removed `MemberInfo.GetDescription()` (use `SelectFromCustomAttribute()` instead) - Removed `Random.NextInt64()` and its overloads. This functionality is built in starting with .NET 6 - Removed `TimeSpanParser.Parse` ## [2.6.0] - 2020-10-20 ### Added - Add `string.AsNullIfEmpty()` - Returns the current string, or `null` if the current string is null or empty. - Add `string.AsNullIfWhiteSpace()` - Returns the current string, or `null` if the current string is null, empty, or consists of only whitespace. - Add `string.Reverse()` - Reverses the current string - Add `string.WithAlternative()` - Returns the current string, or an alternative value if the current string is null or empty, or optionally if the current string consists of only whitespace. ### Changed - n/a ### Removed - n/a ## [2.5.0] - 2020-07-15 ### Added - `WaitHandle.WaitOneAsync()` - Wraps `WaitHandle.WaitOne` as a `Task` - Add support for Unity 2019.4.3f1 - Add `GameObject.LookAt(GameObject)` - Rotates the Transform on the current GameObject so that it faces the Transform on another GameObject - Add `GameObject.LookAt(Transform)` - Rotates the Transform on the current GameObject so that it faces another transform - Add `Transform.LookAt(GameObject)` - Rotates the current Transform so that it faces the Transform on another GameObject - Add `Vector3.Round([float])` - Returns a rounded Vector3 by calling `float.Round()` on each component - Add `Vector3.WithX(float)` - Returns a Vector3 with a new X component value - Add `Vector3.WithY(float)` - Returns a Vector3 with a new Y component value - Add `Vector3.WithZ(float)` - Returns a Vector3 with a new Z component value - Add `Vector3.WithXY(float, float)` - Returns a Vector3 with new X and Y component values - Add `Vector3.WithXZ(float, float)` - Returns a Vector3 with new X and Z component values - Add `Vector3.WithYZ(float, float)` - Returns a Vector3 with new Y and Z component values - Add `BetterBehavior` (experimental wrapper over `MonoBehaviour`) ### Changed - n/a ### Removed - n/a ## [2.2.0] - 2020-04-21 ### Added - Add `string.ChangeEncoding(Encoding, Encoding)` - Converts this string from one encoding to another - Add `string.IsLower()` - Determines if all alpha characters in this string are considered lowercase - Add `string.IsUpper()` - Determines if all alpha characters in this string are considered uppercase - Various extension methods with regards to reflection: - `GetDefaultValue` and `GetDefaultValue` - gets the value stored in the member's `DefaultValue` attribute - `GetDescription`- gets the value stored in the member's `Description` attribute - `SelectFromCustomAttribute` - Internally calls `GetCustomAttribute` and passes it to a `Func` so that specific members may be selected ### Changed - n/a ### Removed - n/a ## [2.1.0] - 2020-04-18 ### Added - Add `bool bool.And(bool)` - Performs logical AND - Add `bool bool.Or(bool)` - Performs logical OR - Add `bool bool.Not(bool)` - Performs logical NOT - Add `bool bool.XOr(bool)` - Performs Logical XOR - Add `bool bool.NAnd(bool)` - Performs logical NAND - Add `bool bool.NOr(bool)` - Performs logical NOR - Add `bool bool.XNOr(bool)` - Performs logical XNOR - Add `byte bool.ToByte()` - 1 if `true`, 0 otherwise - Add `short bool.ToInt16()` - 1 if `true`, 0 otherwise - Add `long bool.ToInt64()` - 1 if `true`, 0 otherwise ### Changed - n/a ### Removed - n/a ## [2.0.0] - 2020-04-18 ### Added - Add `IEnumerable.Split(int)` - Performs the same operation as the previously defined `IEnumerable.Chunkify(int)`, except now accepts any type `T` ### Changed - Fix `DateTime.Last(DayOfWeek)` implementation - Now returns the correct date/time for a given day of the week ### Removed - Remove `IEnumerable.Chunkify(int)` - Replaced by a method of the same behaviour `IEnumerable.Split(int)` ## Earlier versions ### ***Not documented*** [3.0.0 (Unreleased)]: https://github.com/oliverbooth/X10D/tree/develop [2.6.0]: https://github.com/oliverbooth/X10D/releases/tag/2.6.0 [2.5.0]: https://github.com/oliverbooth/X10D/releases/tag/2.5.0 [2.2.0]: https://github.com/oliverbooth/X10D/releases/tag/2.2.0 [2.1.0]: https://github.com/oliverbooth/X10D/releases/tag/2.1.0 [2.0.0]: https://github.com/oliverbooth/X10D/releases/tag/2.0.0