<Type Name="AvoidRepetitiveCallsToPropertiesRule" FullName="Gendarme.Rules.Performance.AvoidRepetitiveCallsToPropertiesRule">
  <TypeSignature Language="C#" Value="public class AvoidRepetitiveCallsToPropertiesRule : Gendarme.Framework.Rule, Gendarme.Framework.IMethodRule" />
  <TypeSignature Language="ILAsm" Value=".class public auto ansi beforefieldinit AvoidRepetitiveCallsToPropertiesRule extends Gendarme.Framework.Rule implements class Gendarme.Framework.IMethodRule, class Gendarme.Framework.IRule" />
  <AssemblyInfo>
    <AssemblyName>Gendarme.Rules.Performance</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.EngineDependency(typeof(Gendarme.Framework.Engines.OpCodeEngine))</AttributeName>
    </Attribute>
    <Attribute>
      <AttributeName>Gendarme.Framework.Problem("This method calls several times into the same properties. This is expensive for virtual properties or when the property cannot be inlined.")</AttributeName>
    </Attribute>
    <Attribute>
      <AttributeName>Gendarme.Framework.Solution("Unless a different value is expected from each call, refactor your code to avoid the multiple calls by caching the returned value.")</AttributeName>
    </Attribute>
  </Attributes>
  <Docs>
    <summary>
            The rule warn if virtual, or unlikely to be inline-able, property getters
            are called several times by a method. In most cases repetitive calls simply
            requires more time without any gains since the result will always be identical.
            You should ignore the reported defects if a different value is expected
            each time the property is called (e.g. calling <c>DateTime.Now</c>).
            </summary>
    <remarks>This rule is available since Gendarme 2.8</remarks>
    <example>
            Bad example:
            <code>
            private int Report (IList list)
            {
            	if (list.Count &gt; 1) {
            		DisplayList (list);
            	}
            	Console.WriteLine ("# items: {0}", list.Count);
            	return list.Count;
            }
            </code></example>
    <example>
            Good example:
            <code>
            private int Report (IList list)
            {
            	int count = list.Count;
            	if (count &gt; 1) {
            		DisplayList (list);
            	}
            	Console.WriteLine ("# items: {0}", count);
            	return count;
            }
            </code></example>
  </Docs>
  <Members>
    <Member MemberName=".ctor">
      <MemberSignature Language="C#" Value="public AvoidRepetitiveCallsToPropertiesRule ();" />
      <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>
    <Member MemberName="InlineLimit">
      <MemberSignature Language="C#" Value="public int InlineLimit { get; set; }" />
      <MemberSignature Language="ILAsm" Value=".property instance int32 InlineLimit" />
      <MemberType>Property</MemberType>
      <AssemblyInfo>
        <AssemblyVersion>2.11.0.0</AssemblyVersion>
      </AssemblyInfo>
      <Attributes>
        <Attribute>
          <AttributeName>System.ComponentModel.DefaultValue(20)</AttributeName>
        </Attribute>
        <Attribute>
          <AttributeName>System.ComponentModel.Description("Maximum IL size of a property getter to be considered inline-able.")</AttributeName>
        </Attribute>
      </Attributes>
      <ReturnValue>
        <ReturnType>System.Int32</ReturnType>
      </ReturnValue>
      <Docs>
        <summary>
            Methods with a code size below InlineLimit (20 by default)
            are considered to be inline-able by the JIT.
            </summary>
        <value>To be added.</value>
        <remarks>To be added.</remarks>
      </Docs>
    </Member>
  </Members>
</Type>
