overload constructor
Published: 20. October 2011 | Updated: 20. October 2011License: Microsoft Public License (MS-PL)
Categories: Framework » Basics
Tags: Basics C#
Example
public class MyClass { public MyClass(string text) { Console.WriteLine("MyClass(string text)"); } // overload public MyClass(string text, int number) : this(text) { Console.WriteLine("MyClass(string text, int number) : this(text)"); } }
Use
new MyClass("a", 5);Console Output:
MyClass(string text)
MyClass(string text, int number) : this(text)
MyClass(string text, int number) : this(text)
| Send us feedback about this snippet » |





