System.Runtime.Serialization.Plists.Extensions.GetConcreteTypeIfNullable C# (CSharp) Method

GetConcreteTypeIfNullable() public static method

Gets the specified type's concrete type of it is an instance of Nullable{T}. If the type is not null-able, it is returned as-is.
public static GetConcreteTypeIfNullable ( this type ) : Type
type this The type to get the concrete type of.
return System.Type
        public static Type GetConcreteTypeIfNullable(this Type type)
        {
            if (type == null)
            {
                throw new ArgumentNullException("type", "type cannot be null.");
            }

            if (type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>))
            {
                return type.GetGenericArguments()[0];
            }

            return type;
        }