﻿<?xml version="1.0" encoding="utf-8"?><Type Name="DoNotDeclareSettersOnCollectionPropertiesRule" FullName="Gendarme.Rules.Design.DoNotDeclareSettersOnCollectionPropertiesRule"><TypeSignature Language="C#" Value="public class DoNotDeclareSettersOnCollectionPropertiesRule : Gendarme.Framework.Rule, Gendarme.Framework.ITypeRule" /><TypeSignature Language="ILAsm" Value=".class public auto ansi beforefieldinit DoNotDeclareSettersOnCollectionPropertiesRule extends Gendarme.Framework.Rule implements class Gendarme.Framework.IRule, class Gendarme.Framework.ITypeRule" /><AssemblyInfo><AssemblyName>Gendarme.Rules.Design</AssemblyName><AssemblyVersion>3.10.0.0</AssemblyVersion></AssemblyInfo><Base><BaseTypeName>Gendarme.Framework.Rule</BaseTypeName></Base><Interfaces><Interface><InterfaceName>Gendarme.Framework.ITypeRule</InterfaceName></Interface></Interfaces><Attributes><Attribute><AttributeName>Gendarme.Framework.FxCopCompatibility("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")</AttributeName></Attribute><Attribute><AttributeName>Gendarme.Framework.Problem("A visible setter is declared for an ICollection (or derived) property")</AttributeName></Attribute><Attribute><AttributeName>Gendarme.Framework.Solution("Replace the setter with a method or decrease the setter visibility")</AttributeName></Attribute></Attributes><Docs><summary>
            The rule detect <c>System.Collections.ICollection</c> and
            <c>System.Collections.Generic.ICollection&lt;T&gt;</c> properties that declare a visible setter.
            There is rarely a need to be able to replace the collection (e.g. most collections provide a <c>Clear</c>
            method) and having a getter only does not prevent the consumer from adding and removing items in the collection.
            Also read-only properties have special support for binary and XML serialization, making your code more useful.
            A special exception is made for <c>System.Security.PermissionSet</c> and types that derives from it.
            </summary><remarks>To be added.</remarks><example>
            Bad example:
            <code>
            public class Holder {
            	public string Name { get; set; }
            	public ICollection&lt;string&gt; List { get; set; }
            }
            public static Holder Copy (Holder h)
            {
            	Holder copy = new Holder ();
            	copy.Name = h.Name;
            	// bad, same list would be shared between instances
            	copy.List = h.List;
            	copy.List.AddRange (h.List);
            	return copy;
            }
            </code></example><example>
            Good example:
            <code>
            public class Holder {
            	List&lt;string&gt; list;
            	public Holder ()
            	{
            		list = new List&lt;string&gt; ();
            	}
            	public string Name { get; set; }
            	public ICollection&lt;string&gt; List {
            		get { return list; }
            	}
            }
            public static Holder Copy (Holder h)
            {
            	Holder copy = new Holder ();
            	copy.Name = h.Name;
            	copy.List.AddRange (h.List);
            	return copy;
            }
            </code></example></Docs><Members><Member MemberName=".ctor"><MemberSignature Language="C#" Value="public DoNotDeclareSettersOnCollectionPropertiesRule ();" /><MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor() cil managed" /><MemberType>Constructor</MemberType><AssemblyInfo><AssemblyVersion>3.10.0.0</AssemblyVersion></AssemblyInfo><Parameters /><Docs><summary>To be added.</summary><remarks>To be added.</remarks></Docs></Member><Member MemberName="CheckType"><MemberSignature Language="C#" Value="public Gendarme.Framework.RuleResult CheckType (Mono.Cecil.TypeDefinition type);" /><MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance valuetype Gendarme.Framework.RuleResult CheckType(class Mono.Cecil.TypeDefinition type) cil managed" /><MemberType>Method</MemberType><AssemblyInfo><AssemblyVersion>3.10.0.0</AssemblyVersion></AssemblyInfo><ReturnValue><ReturnType>Gendarme.Framework.RuleResult</ReturnType></ReturnValue><Parameters><Parameter Name="type" Type="Mono.Cecil.TypeDefinition" /></Parameters><Docs><param name="type">To be added.</param><summary>To be added.</summary><returns>To be added.</returns><remarks>To be added.</remarks></Docs></Member></Members></Type>