Burntchips
Programmer
Hello all,
I'm creating a wrapper class for entries in a database. I've created all of the properties in my class to match the columns in the database but I am wondering what is the best practice for instantiating one of these objects. The two approaches I'm debating are using either:
[VB]
Dim myPerson as Person = Person.LoadPerson("bob")
[C#]
Person myPerson = Person.LoadPerson("bob");
Or
[VB]
Dim myPerson as Person = new Person("bob")
[C#]
Person myPerson = new Person("bob");
Which of those are the best approach and why? Does creating a static LoadPerson method have any negative performance effects?
I'm creating a wrapper class for entries in a database. I've created all of the properties in my class to match the columns in the database but I am wondering what is the best practice for instantiating one of these objects. The two approaches I'm debating are using either:
[VB]
Dim myPerson as Person = Person.LoadPerson("bob")
[C#]
Person myPerson = Person.LoadPerson("bob");
Or
[VB]
Dim myPerson as Person = new Person("bob")
[C#]
Person myPerson = new Person("bob");
Which of those are the best approach and why? Does creating a static LoadPerson method have any negative performance effects?