My class has quite some properties and one of my constructors sets them all, I want the default constructor to call this other one and use the set properties. But I need to prepare arguments first, so calling it from the header won't help.
Here's what I'd like to do:
public class Test { private int result, other; // The other constructor can be called from header, // but then the argument cannot be prepared. public Test() : this(0) { // Prepare arguments. int calculations = 1; // Call constructor with argument. this(calculations); // Do some other stuff. other = 2; } public Test(int number) { // Assign inner variables. result = number; } } So this is not possible, does anyone know how to call my constructor to set parameters inside code? Currently I'm storing a copy of the object from the other constructor and copying all the properties, it's really annoying.