Exemplo n.º 1
0
        /// <summary>
        /// Returns the nullable representation of the underlying type.
        /// </summary>
        /// <returns>If a non-nullable value type, returns the nullable type. Otherwise echoes the type.</returns>
        public ClassMetadata MakeNullable()
        {
            if (TypeInfo.IsValueType && !IsNullable)
            {
                return(MetadataCache.GetMetadata(typeof(Nullable <>).MakeGenericType(new[] { TypeInfo })));
            }

            return(this);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Returns the non-nullable representation of the underlying type.
        /// </summary>
        /// <returns>If a nullable value type, returns the non-nullable type. Otherwise echoes the type.</returns>
        public ClassMetadata MakeNonNullable()
        {
            if (TypeInfo.IsGenericType && (TypeInfo.GetGenericTypeDefinition() == typeof(Nullable <>)))
            {
                return(MetadataCache.GetMetadata(TypeInfo.GetGenericArguments()[0]));
            }

            return(this);
        }