<Type Name="AvoidReturningArraysOnPropertiesRule" FullName="Gendarme.Rules.Performance.AvoidReturningArraysOnPropertiesRule">
  <TypeSignature Language="C#" Value="public class AvoidReturningArraysOnPropertiesRule : Gendarme.Framework.Rule, Gendarme.Framework.IMethodRule" />
  <TypeSignature Language="ILAsm" Value=".class public auto ansi beforefieldinit AvoidReturningArraysOnPropertiesRule 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.FxCopCompatibility("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")</AttributeName>
    </Attribute>
    <Attribute>
      <AttributeName>Gendarme.Framework.Problem("By convention properties should not return arrays.")</AttributeName>
    </Attribute>
    <Attribute>
      <AttributeName>Gendarme.Framework.Solution("Return a read-only collection or replace the property by a method and return a copy of the array.")</AttributeName>
    </Attribute>
  </Attributes>
  <Docs>
    <summary>
            This rule check for properties which return arrays. This can be a problem because
            properties are supposed to execute very quickly so it's likely that this property
            is returning a reference to the internal state of the object. This means that
            the caller can change the object's internal state via a back-door channel which
            is usually a very bad thing and it means that the array's contents may change
            unexpectedly if the caller holds onto the array.
            The preferred approach is to either return a read-only collection or to change
            the property to a method and return a copy of the array (it's important to use
            a method so that callers are not misled about the performance of the property).
            </summary>
    <remarks>To be added.</remarks>
    <example>
            Bad example:
            <code>
            public byte[] Foo {
            	get {
            		// return the data inside the instance
            		return foo;
            	}
            }
            public byte[] Bar {
            	get {
            		// return a copy of the instance's data
            		// (this is bad because users expect properties to execute quickly)
            		return (byte[]) bar.Clone ();
            	}
            }
            </code></example>
    <example>
            Good example:
            <code>
            public byte[] GetFoo ()
            {
            	return (byte[]) foo.Clone ();
            }
            public byte[] GetFoo ()
            {
            	return (byte[]) bar.Clone ();
            }
            </code></example>
  </Docs>
  <Members>
    <Member MemberName=".ctor">
      <MemberSignature Language="C#" Value="public AvoidReturningArraysOnPropertiesRule ();" />
      <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="Initialize">
      <MemberSignature Language="C#" Value="public override void Initialize (Gendarme.Framework.IRunner runner);" />
      <MemberSignature Language="ILAsm" Value=".method public hidebysig virtual instance void Initialize(class Gendarme.Framework.IRunner runner) cil managed" />
      <MemberType>Method</MemberType>
      <AssemblyInfo>
        <AssemblyVersion>2.11.0.0</AssemblyVersion>
      </AssemblyInfo>
      <ReturnValue>
        <ReturnType>System.Void</ReturnType>
      </ReturnValue>
      <Parameters>
        <Parameter Name="runner" Type="Gendarme.Framework.IRunner" />
      </Parameters>
      <Docs>
        <param name="runner">To be added.</param>
        <summary>To be added.</summary>
        <remarks>To be added.</remarks>
      </Docs>
    </Member>
  </Members>
</Type>
