why constructor like public Exception(string message) has NO curly bracket in C# ?


  • Hi,
    As you can see from the below codes, the constructors have no curly bracket({}) implemented on them. This class is belong to C:\Windows\Microsoft.NET\Framework\v2.0.50727\mscorlib.dll assembly. When I try to implement my own class and declare my own constructor without the curly bracket, I got this error message "must declare a body because it is not marked abstract, extern, or partial". I just wonder why most Exception class from Microsoft can implemented this but we can't create for the custom class ? Is it possible to create the constructor without the curly bracket ?

    public class Exception : ISerializable, _Exception



    public Exception();


    public Exception(string message);


    public Exception(string message, Exception innerException);



     Thanks for your answer.

    Friday, July 30, 2010 3:13 AM