Skip to content

Gendarme.Rules.Design.Generic.DoNotExposeGenericListsRule(git)

Sebastien Pouliot edited this page Mar 2, 2011 · 1 revision

DoNotExposeGenericListsRule

Assembly: Gendarme.Rules.Design.Generic
Version: git

Description

A type has an externally visible member that is, returns or has a signature containing a [[System.Collections.Generic.List<T>|http://msdn.microsoft.com/library/System.Collections.Generic.List.aspx]].

Examples

Bad example:

public class BadClass {
    public List<string> member { get; set; };
}

Good example:

public class GoodClass {
    public Collection<string> member { get; set; };
}

Notes

  • This rule applies only to assemblies targeting .NET 2.0 and later.

Source code

You can browse the latest source code of this rule on github.com

Clone this wiki locally