public static Boolean IsNullable(this Type baseType) { return(DDRIT.IsNullable(baseType)); }
public static String GetRelativePath(this FileSystemInfo sourcePath, FileSystemInfo destinationPath) { return(DDRIT.GetRelativePath(sourcePath, destinationPath)); }
/// <summary> /// Attempt to serialize any object into a Binary Encoded string. /// </summary> /// <param name="input">The object to serialize.</param> /// <returns>A string containing the serialized object.</returns> public static String ToBinary(this Object input) { return(DDRIT.ToBinary(input)); }
/// <summary> /// Returns the date of the first day of the week starting on <paramref name="startOfWeek" />, which contains <paramref name="date"/>. /// </summary> /// <param name="date"></param> /// <param name="startOfWeek"></param> /// <returns></returns> public static DateTimeOffset StartOfWeek(this DateTimeOffset date, DayOfWeek startOfWeek = DayOfWeek.Sunday) { return(DDRIT.StartOfWeek(date, startOfWeek)); }
public static TValue GetValue <TKey, TValue>(this Dictionary <TKey, TValue> input, TKey key, TValue @default) { return(DDRIT.GetValue <TKey, TValue>(input, key, @default)); }
/// <summary> /// Attempt to serialize any object into a JSON string. /// </summary> /// <param name="input">The object to serialize.</param> /// <returns>A string containing the serialized object.</returns> public static String ToJSON(this Object input, Formatting formatting = Formatting.Indented, TypeNameHandling typeNameHandling = TypeNameHandling.None) { return(DDRIT.ToJSON(input, formatting, typeNameHandling)); }
/// <summary> /// Trim a DateTime to the smallest whole TimeSpan that fits within a 24 hour period. /// </summary> /// <param name="input">The time to trim</param> /// <param name="interval">The smallest timespan per day to allow</param> /// <returns></returns> public static DateTimeOffset TrimTo(this DateTimeOffset input, TimeSpan interval) { return(DDRIT.TrimTo(input, interval)); }
/// <summary> /// Return the hash of a string value /// </summary> /// <param name="input">The string to hash</param> /// <returns>An SHA512 hash of the given string</returns> public static String ToSHA512(this String input) { return(DDRIT.ToSHA512(input)); }
public static TEnum[] ToFlagsArray <TEnum>(this Enum value) where TEnum : struct { return(DDRIT.ToFlagsArray <TEnum>(value)); }
/// <summary> /// Converts a the input <paramref name="bytes"/> to a hex string. /// </summary> /// <param name="bytes">Array of bytes to convert to hex string.</param> /// <returns>A hex string representation of the input <paramref name="bytes"/>.</returns> public static String ToHex(this Byte[] bytes) { return(DDRIT.ToHex(bytes)); }
/// <summary> /// Return the hash of a string value /// </summary> /// <param name="input">The string to hash</param> /// <returns>An MD5 hash of the given string</returns> public static String ToMD5(this String input) { return(DDRIT.ToMD5(input)); }
public static String GetFriendlyTypeName(this Type type) { return(DDRIT.GetFriendlyTypeName(type)); }
/// <summary> /// Get a list of all non-system dependencies for a given type. /// </summary> /// <param name="type">The type to interrogate</param> /// <returns>An enumerable of all the dependencies referenced by the specified type.</returns> public static IEnumerable <Type> GetDependencies(this Type type) { return(DDRIT.GetDependencies(type)); }
public static TAttribute GetAttribute <TAttribute>(this Type type) where TAttribute : Attribute { return(DDRIT.GetAttribute <TAttribute>(type)); }
/// <summary> /// Strip HTML/XML tags from any string. /// </summary> /// <param name="input">HTML content.</param> /// <returns>Content free of HTML tags.</returns> public static String StripTags(this String input) { return(DDRIT.StripTags(input)); }
public static TEnum FromFlagsArray <TEnum>(this IEnumerable <TEnum> flags) where TEnum : struct { return(DDRIT.FromFlagsArray <TEnum>(flags)); }
/// <summary> /// Attempt to deserialize any JSON string into an object. /// </summary> /// <typeparam name="TResult">The type to convert to.</typeparam> /// <param name="input">The string to deserialize to an object.</param> /// <returns>An Object of type T deserialized from the string.</returns> public static TResult FromJSON <TResult>(this String input, TypeNameHandling typeNameHandling = TypeNameHandling.None) { return(DDRIT.FromJSON <TResult>(input, typeNameHandling)); }
/// <summary> /// Return the friendly description of an enum value, if it has been decorated with the DescriptionAttribute, /// otherwise, return the internal string representation of the enum value. /// </summary> /// <param name="value"></param> /// <returns></returns> public static String ToDescription(this Enum value, Boolean expandFlags = true) { return(DDRIT.ToDescription(value, expandFlags)); }
/// <summary> /// Attempt to deserialize any JSON string into an object. /// </summary> /// <param name="input">The string to deserialize to an object.</param> /// <param name="type">The type to convert to.</param> /// <returns>An Object deserialized from the string.</returns> public static Object FromJSON(this String input, Type type, TypeNameHandling typeNameHandling = TypeNameHandling.None) { return(DDRIT.FromJSON(input, type, typeNameHandling)); }
public static TEnum?ToEnum <TEnum>(this Enum value, TEnum? @default) where TEnum : struct { return(DDRIT.ToEnum <TEnum>(value, @default)); }
/// <summary> /// Trim a TimeSpan to the smallest whole TimeSpan that fits within a 24 hour period. /// </summary> /// <param name="input">The time to trim</param> /// <param name="interval">The smallest timespan per day to allow</param> /// <returns></returns> public static TimeSpan TrimTo(this TimeSpan input, TimeSpan interval) { return(DDRIT.TrimTo(input, interval)); }
public static TEnum?ToEnum <TEnum>(this String input, Boolean ignoreCase = true) where TEnum : struct { return(DDRIT.ToEnum <TEnum>(input, ignoreCase)); }
/// <summary> /// Returns the date of the last day of the week ending on <paramref name="startOfWeek"/>, which contains <paramref name="date"/>. /// </summary> /// <param name="date"></param> /// <param name="startOfWeek"></param> /// <returns></returns> public static DateTime EndOfWeek(this DateTime date, DayOfWeek startOfWeek = DayOfWeek.Sunday) { return(DDRIT.EndOfWeek(date, startOfWeek)); }
/// <typeparam name="TSource"></typeparam> /// <param name="source">The System.Collections.Generic.IEnumerable<<typeparamref name="TSource"/>> to return the first element of.</param> /// <param name="default">The default value to return if the source is empty.</param> /// <returns><paramref name="default"/> if <paramref name="source"/> is empty; otherwise, the first element in <paramref name="source"/>.</returns> /// <exception cref="System.ArgumentNullException"><paramref name="source"/> is null.</exception> public static TSource FirstOrDefault <TSource>(this IEnumerable <TSource> source, TSource @default) { return(DDRIT.FirstOrDefault(source, @default)); }
public static String FilePathToUri(this String path) { return(DDRIT.FilePathToUri(path)); }
/// <typeparam name="TSource"></typeparam> /// <param name="source">The System.Collections.Generic.IEnumerable<<typeparamref name="TSource"/>> to return the first element of.</param> /// <param name="default">The default value to return if the source is empty.</param> /// <returns><paramref name="default"/> if <paramref name="source"/> is empty or if no element passes the test specified by <paramref name="predicate"/>; /// otherwise, the first element in <paramref name="source"/> that passes the test specified by <param name="predicate"/>.</returns> /// <exception cref="System.ArgumentNullException"><paramref name="source"/> or <paramref name="predicate"/> is null.</exception> public static TSource FirstOrDefault <TSource>(this IEnumerable <TSource> source, Func <TSource, Boolean> predicate, TSource @default) { return(DDRIT.FirstOrDefault(source, predicate, @default)); }
/// <summary> /// Attempt to deserialize any Binary Encoded string into an object. /// </summary> /// <typeparam name="TResult">The type to convert to.</typeparam> /// <param name="input">The string to deserialize to an object.</param> /// <returns>An Object of type T deserialized from the string.</returns> public static TResult FromBinary <TResult>(this String input) { return(DDRIT.FromBinary <TResult>(input)); }
/// <summary> /// Trim markup to the longest string of whole words, under a particular length, and append an elipsis if there is truncated content. /// If the length is shorter than the first whole word, then returns the first whole word, and appends an elipsis if there is truncated content. /// </summary> /// <param name="input">The content to trim</param> /// <param name="maxLength">The maximum length of the returned content</param> /// <param name="stripTags">(true)Remove HTML tags before trimming</param> /// <returns></returns> public static String TrimTo(this String input, Int32 maxLength, Boolean stripTags = true) { return(DDRIT.TrimTo(input, maxLength, stripTags)); }
/// <summary> /// Attempt to deserialize any Binary Encoded string into an object. /// </summary> /// <param name="input">The string to deserialize to an object.</param> /// <param name="type">The type to convert to.</param> /// <returns>An Object deserialized from the string.</returns> public static Object FromBinary(this String input) { return(DDRIT.FromBinary(input)); }
public static TimeSpan ToTimeSpan(this String input, TimeSpan @default) { return(DDRIT.ToTimeSpan(input, @default)); }