Rufen Sie einen Konstruktor aus dem Körper des anderen in C#

Muss ich rufen Sie einen Konstruktor aus dem Körper des anderen. Wie kann ich das tun?

Grundsätzlich

class foo {
    public foo (int x, int y)
    {
    }

    public foo (string s)
    {
        //... do something

        //Call another constructor
        this (x, y); //Doesn't work
        foo (x, y); //neither
    }
}
  • Wie wäre es mit einem Konstruktor wie public foo (int x, int y , string s)
InformationsquelleAutor tom | 2011-09-27
Schreibe einen Kommentar