mercredi 6 mai 2015

which method of creating an instance is a "better" method and why? [on hold]

I was just wondering whether one of these methods of creating an instance is a “better” solution, if so then why?

 method 1:   MyClass myClass = new MyClass();
 method 2:   MyClass myClass2 = MyClass.Create();


public class MyClass
{
    public string Name { get; set; }

    public static MyClass Create()
    {
        return new MyClass();
    }
}

Kind Regards

Aucun commentaire:

Enregistrer un commentaire