Collection of extension method for the BCL to ease their usage. Please feel free to submit bits that are not yet included.
var stringValue = "text";
_ = stringValue.IsNullOrEmpty();
_ = stringValue.IsNullOrWhiteSpace();
_ = stringValue.HasValue();
_ = stringValue.HasActualValue();
_ = "{0} {1}".FormatWith(1, 2);
// Int, uint, long, ulong, byte
var number = 123;
_ = intValue.Clamp(0, 100);
_ = intValue.ToBool(); // each type has its revers bool to number.
var doubleValue = 12.34;
_ = doubleValue.Clamp(0, 100);
_ = doubleValue.IsInfinity();
_ = doubleValue.IsNegativeInfinity();
_ = doubleValue.IsPositiveInfinity();
_ = doubleValue.IsNaN();
_ = doubleValue.IsEqual(34.12,tolerance: 0.1); //two NaNs are also evaluated as equals
var collection = new[] {1, 2, 3};
_ = collection.HasIndex(4);
_ = collection.AtIndexOrDefault(4);
_ = collection.AtIndexOrFallback(4, -1);
_ = collection.IsEmpty();
var directory = new Dictionary<int, int>();
_ = directory.AtKeyOrFallback(4, -1);
// Extensions for IList<T>, IEnumerable<T> and Enumerable
var collection = new[] {1, 2, 3};
collection.For((index, value) => {});
collection.ForEach(value => {});
_ = collection.SelectWithIndex((index, value) => value);
_ = collection.SelectTypeOf<double>();
var secondCollection = new[] {4, 5};
_ = collection.Append(secondCollection);
Install-Package PlainBytes.System.Extensions
dotnet add package PlainBytes.System.Extensions
Target platform: .Net Standard 1.0 and above.