StaticProxy.Interceptor.Invocation.SetArgumentValue C# (CSharp) Метод

SetArgumentValue() публичный Метод

public SetArgumentValue ( int index, object value ) : void
index int
value object
Результат void
        public void SetArgumentValue(int index, object value)
        {
            var expectedParameterType = this.parameterTypes.Value[index];
            if (value == null)
            {
                if (expectedParameterType.GetTypeInfo().IsValueType)
                {
                    throw new ArgumentNullException(
                        index.ToString(),
                        string.Format(CultureInfo.InvariantCulture, "Cannot set value-type ({0}) parameter to null", expectedParameterType));
                }
            }
            else
            {
                var actualParameterType = value.GetType();
                if (!expectedParameterType.GetTypeInfo().IsAssignableFrom(actualParameterType.GetTypeInfo()))
                {
                    throw new ArgumentOutOfRangeException(
                        index.ToString(),
                        string.Format(CultureInfo.InvariantCulture, "Cannot set {0} parameter to value of type {1}", expectedParameterType, actualParameterType));
                }
            }
            
            this.arguments[index] = value;
        }