System.Linq.Expressions.Error.VariableMustNotBeByRef C# (CSharp) Méthode

VariableMustNotBeByRef() static private méthode

ArgumentException with message like "Variable '{0}' uses unsupported type '{1}'. Reference types are not supported for variables."
static private VariableMustNotBeByRef ( object p0, object p1, string paramName ) : Exception
p0 object
p1 object
paramName string
Résultat Exception
        internal static Exception VariableMustNotBeByRef(object p0, object p1, string paramName)
        {
            return new ArgumentException(Strings.VariableMustNotBeByRef(p0, p1), paramName);
        }
        /// <summary>

Same methods

Error::VariableMustNotBeByRef ( object p0, object p1, string paramName, int index ) : Exception

Usage Example

        // Checks that all variables are non-null, not byref, and unique.
        internal static void ValidateVariables(ReadOnlyCollection <ParameterExpression> varList, string collectionName)
        {
            if (varList.Count == 0)
            {
                return;
            }

            int count = varList.Count;
            var set   = new Set <ParameterExpression>(count);

            for (int i = 0; i < count; i++)
            {
                ParameterExpression v = varList[i];
                if (v == null)
                {
                    throw new ArgumentNullException(string.Format(System.Globalization.CultureInfo.CurrentCulture, "{0}[{1}]", collectionName, set.Count));
                }
                if (v.IsByRef)
                {
                    throw Error.VariableMustNotBeByRef(v, v.Type);
                }
                if (set.Contains(v))
                {
                    throw Error.DuplicateVariable(v);
                }
                set.Add(v);
            }
        }
All Usage Examples Of System.Linq.Expressions.Error::VariableMustNotBeByRef
Error