I said to a colleague that following is bad design, but in the end I couldn't really give any reason why (apart from that in this case there was already a singleton class that kind of was used as "collection" for all these). But in general case is there nothing wrong with following?
public class MyClass
{
public int Id { get; set; }
/... other properties, constructors & methods
// this is only static method
public static GetMyClass(int id)
{
// get it in this case from unmanaged code
return new MyClass(InteropThing.GetMyClassStruct(id));
}
}
Aucun commentaire:
Enregistrer un commentaire