It doesn't look like you can override an empty constructor. Instead, I would create a method that performs the necessary functions in an empty constructor and returns a new object.
// Add new partial class to extend functionality public partial class User { // Add additional constructor public User(int id) { ID = id; } // Add static method to initialize new object public User GetNewUser() { // functionality User user = new User(); user.Name = "NewName"; return user; } }
Then, in another place in your code, instead of using the empty default constructor, do one of the following:
User user1 = new User(1); User user2 = User.GetNewUser();
Yaakov Ellis Sep 17 '08 at 12:17 2008-09-17 12:17
source share