using System;
namespace IPA.Utilities
{
///
/// A class providing various extension methods.
///
public static class Extensions
{
///
/// Gets the default value for a given .
///
/// the to get the default value for
/// the default value of
public static object GetDefault(this Type type)
{
return type.IsValueType ? Activator.CreateInstance(type) : null;
}
///
/// Unwraps a where T is such that if the value is null, it gives .
///
/// the bool? to unwrap
/// the unwrapped value, or if it was
public static bool Unwrap(this bool? self) => self != null && self.Value;
}
}