[Solved] Can you pass arguments to many constructor methods in C#? [closed]


If I got your question right, you’re looking for something like Constructor-Chaining

public class Class1
    {
        public Class1()
            : this(string.Empty)
        {

        }

        public Class1(string val1)
            : this(val1, string.Empty)
        {

        }

        public Class1(string val1, string val2)
            :this(val1, val2, string.Empty)
        {

        }

        public Class1(string val1, string val2, string val3)
        {
            // Do something with the val's
        }
    }

1

solved Can you pass arguments to many constructor methods in C#? [closed]