﻿<?xml version="1.0" encoding="utf-8"?><Type Name="InstantiateArgumentExceptionCorrectlyRule" FullName="Gendarme.Rules.Exceptions.InstantiateArgumentExceptionCorrectlyRule"><TypeSignature Language="C#" Value="public class InstantiateArgumentExceptionCorrectlyRule : Gendarme.Framework.Rule, Gendarme.Framework.IMethodRule" /><TypeSignature Language="ILAsm" Value=".class public auto ansi beforefieldinit InstantiateArgumentExceptionCorrectlyRule extends Gendarme.Framework.Rule implements class Gendarme.Framework.IMethodRule, class Gendarme.Framework.IRule" /><AssemblyInfo><AssemblyName>Gendarme.Rules.Exceptions</AssemblyName><AssemblyVersion>4.2.0.0</AssemblyVersion></AssemblyInfo><Base><BaseTypeName>Gendarme.Framework.Rule</BaseTypeName></Base><Interfaces><Interface><InterfaceName>Gendarme.Framework.IMethodRule</InterfaceName></Interface></Interfaces><Attributes><Attribute><AttributeName>Gendarme.Framework.EngineDependency(typeof(Gendarme.Framework.Engines.OpCodeEngine))</AttributeName></Attribute><Attribute><AttributeName>Gendarme.Framework.FxCopCompatibility("Microsoft.Usage", "CA2208:InstantiateArgumentExceptionsCorrectly")</AttributeName></Attribute><Attribute><AttributeName>Gendarme.Framework.Problem("This method throws ArgumentException (or derived) exceptions without specifying an existing parameter name. This can hide useful information to developers.")</AttributeName></Attribute><Attribute><AttributeName>Gendarme.Framework.Solution("Fix the exception parameters to use the correct parameter name (or make sure the parameters are in the right order).")</AttributeName></Attribute></Attributes><Docs><summary>
             This rule will fire if the arguments to the <c>System.ArgumentException</c>, 
             <c>System.ArgumentNullException</c>, <c>System.ArgumentOutOfRangeException</c>,
             and <c>System.DuplicateWaitObjectException</c> constructors are used incorrectly.
             This is a common mistake because the position of the <c>parameterName</c> argument
             is not consistent across these types.
             </summary><remarks>This rule is available since Gendarme 2.2</remarks><example>
             Bad example:
             <code>
             public void Show (string s)
             {
            	if (s == null) {
            		// the first argument should be the parameter name
            		throw new ArgumentNullException ("string is null", "s");
            	}
            	if (s.Length == 0) {
            		// the second argument should be the parameter name
            		return new ArgumentException ("s", "string is empty");
            	}
            	Console.WriteLine (s);
             }
             </code></example><example>
             Good example:
             <code>
             public void Show (string s)
             {
            	if (s == null) {
            		throw new ArgumentNullException ("s", "string is null");
            	}
            	if (s.Length == 0) {
            		return new ArgumentException ("string is empty", "s");
            	}
            	Console.WriteLine (s);
             }
             </code></example></Docs><Members><Member MemberName=".ctor"><MemberSignature Language="C#" Value="public InstantiateArgumentExceptionCorrectlyRule ();" /><MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor() cil managed" /><MemberType>Constructor</MemberType><AssemblyInfo><AssemblyVersion>4.2.0.0</AssemblyVersion></AssemblyInfo><Parameters /><Docs><summary>To be added.</summary><remarks>To be added.</remarks></Docs></Member><Member MemberName="CheckMethod"><MemberSignature Language="C#" Value="public Gendarme.Framework.RuleResult CheckMethod (Mono.Cecil.MethodDefinition method);" /><MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance valuetype Gendarme.Framework.RuleResult CheckMethod(class Mono.Cecil.MethodDefinition method) cil managed" /><MemberType>Method</MemberType><AssemblyInfo><AssemblyVersion>4.2.0.0</AssemblyVersion></AssemblyInfo><ReturnValue><ReturnType>Gendarme.Framework.RuleResult</ReturnType></ReturnValue><Parameters><Parameter Name="method" Type="Mono.Cecil.MethodDefinition" /></Parameters><Docs><param name="method">To be added.</param><summary>To be added.</summary><returns>To be added.</returns><remarks>To be added.</remarks></Docs></Member></Members></Type>