Is this physical collection class that contains only static methods an Anti-Pattern?

Posted by Tj Kellie on Stack Overflow See other posts from Stack Overflow or by Tj Kellie
Published on 2010-03-15T15:02:21Z Indexed on 2010/03/15 15:09 UTC
Read the original article Hit count: 217

Filed under:
|

I'm trying to figure out if I should continue on with a current pattern in an application I'm working in, or refactor this into something else.

I have a set of collection classes off a generic base of List. These classes have public constructors but contain only static methods that return collections. They look like this:

public class UserObjCollection : BaseCollection<UserObj>
{
  public static UserObjCollection GetAllUserObj()
  {
    UserObjCollection obj = new UserObjCollection();
    obj.MapObjects(new UserObjDataService().GetAllUserObj());
    return obj;
  }
}

Is this a Pattern or Anti-Pattern and what are the merits of this over a straight factory pattern?

© Stack Overflow or respective owner

Related posts about c#

Related posts about design-patterns