System.Runtime.CompilerServices.ReadOnlyCollectionBuilder.ValidateNullValue C# (CSharp) Метод

ValidateNullValue() приватный статический Метод

private static ValidateNullValue ( object? value, string argument ) : void
value object?
argument string
Результат void
        private static void ValidateNullValue(object? value, string argument)
        {
            if (value == null && default(T) != null)
            {
                throw Error.InvalidNullValue(typeof(T), argument);
            }
        }

Usage Example

Пример #1
0
        void IList.Insert(int index, object value)
        {
            ReadOnlyCollectionBuilder <T> .ValidateNullValue(value, "value");

            try
            {
                this.Insert(index, (T)value);
            }
            catch (InvalidCastException)
            {
                ReadOnlyCollectionBuilder <T> .ThrowInvalidTypeException(value, "value");
            }
        }
All Usage Examples Of System.Runtime.CompilerServices.ReadOnlyCollectionBuilder::ValidateNullValue