Skip to content
This repository has been archived by the owner on Jun 30, 2021. It is now read-only.

Simplify.Extensions

Alexanderius edited this page Aug 18, 2016 · 4 revisions

Provides system classes extensions.

Available at NuGet as binary package and source package

Bytes extensions

// Converts bytes array to astring.
public static string GetString(this byte[] bytes);

Double extensions

// Checking what two double values most likely the same ( the difference between values is less than Epsilon)
public static bool AreSameAs(this double a, double b);

String extensions

// Convert string to the bytes array.
public static byte[] ToBytesArray(this string str);

// Converts the specified string representation of a date and time to its DateTime? equivalent using the specified format, invariant culture format information. The format of the string representation must match at least one of the specified formats exactly. The method returns a value if the conversion succeeded otherwise null
public static DateTime? TryToDateTimeExact(this string s, string format);

DateTime extensions

// Removes milliseconds from the DateTime
public static DateTime TrimMilliseconds(this DateTime dt);