<Type Name="CheckParametersNullityInVisibleMethodsRule" FullName="Gendarme.Rules.Correctness.CheckParametersNullityInVisibleMethodsRule">
  <TypeSignature Language="C#" Value="public class CheckParametersNullityInVisibleMethodsRule : Gendarme.Framework.Rule, Gendarme.Framework.IMethodRule" />
  <TypeSignature Language="ILAsm" Value=".class public auto ansi beforefieldinit CheckParametersNullityInVisibleMethodsRule extends Gendarme.Framework.Rule implements class Gendarme.Framework.IMethodRule, class Gendarme.Framework.IRule" />
  <AssemblyInfo>
    <AssemblyName>Gendarme.Rules.Correctness</AssemblyName>
    <AssemblyVersion>2.11.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.FxCopCompatibility("Microsoft.Design", "CA1062:ValidateArgumentsOfPublicMethods")</AttributeName>
    </Attribute>
    <Attribute>
      <AttributeName>Gendarme.Framework.Problem("A visible method does not check its parameter(s) for null values.")</AttributeName>
    </Attribute>
    <Attribute>
      <AttributeName>Gendarme.Framework.Solution("Since the caller is unknown you should always verify all of your parameters to protect yourself.")</AttributeName>
    </Attribute>
  </Attributes>
  <Docs>
    <summary>
            This rule checks if all nullable parameters of visible methods are compared
            with '''null''' before they get used. This reduce the likelyhood of the runtime
            throwing a <c>NullReferenceException</c>.
            </summary>
    <remarks>This rule is available since Gendarme 2.2</remarks>
    <example>
            Bad example:
            <code>
            [DllImport ("message")]
            internal static extern byte [] Parse (string s, int length);
            public bool TryParse (string s, out Message m)
            {
            	// is 's' is null then 's.Length' will throw a NullReferenceException
            	// which a TryParse method should never do
            	byte [] data = Parse (s, s.Length);
            	if (data == null) {
            		m = null;
            		return false;
            	}
            	m = new Message (data);
            	return true;
            }
            </code></example>
    <example>
            Good example:
            <code>
            [DllImport ("message")]
            internal static extern byte [] Parse (string s, int length);
            public bool TryParse (string s, out Message m)
            {
            	if (s == null) {
            		m = null;
            		return false;
            	}
            	byte [] data = Parse (s, s.Length);
            	if (data == null) {
            		m = null;
            		return false;
            	}
            	m = new Message (data);
            	return true;
            }
            </code></example>
  </Docs>
  <Members>
    <Member MemberName=".ctor">
      <MemberSignature Language="C#" Value="public CheckParametersNullityInVisibleMethodsRule ();" />
      <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor() cil managed" />
      <MemberType>Constructor</MemberType>
      <AssemblyInfo>
        <AssemblyVersion>2.11.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>2.11.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>
