Skip to main content
corrected something
Source Link
Jon Limjap
  • 95.7k
  • 15
  • 104
  • 153

Modify your constructor to the following so that it calls the base class constructor properly:

public class MyExceptionClass : Exception
{
    public MyExceptionClass(string message, string extrainfo) : base(message)
    {
        //other stuff here
    }
}

Note that a constructor is not a methodsomething that you can call anytime within a method. That's the reason you're getting errors in your call in the constructor body.

Modify your constructor to the following so that it calls the base class constructor properly:

public class MyExceptionClass : Exception
{
    public MyExceptionClass(string message, string extrainfo) : base(message)
    {
        //other stuff here
    }
}

Note that a constructor is not a method that you can call anytime within a method. That's the reason you're getting errors in your call in the body.

Modify your constructor to the following so that it calls the base class constructor properly:

public class MyExceptionClass : Exception
{
    public MyExceptionClass(string message, string extrainfo) : base(message)
    {
        //other stuff here
    }
}

Note that a constructor is not something that you can call anytime within a method. That's the reason you're getting errors in your call in the constructor body.

completed code structure
Source Link
Jon Limjap
  • 95.7k
  • 15
  • 104
  • 153

Modify your constructor to the following so that it calls the base class constructor properly:

public class MyExceptionClass : Exception
{
    public MyExceptionClass(string message, string extrainfo) : base(message)
    {
        //other stuff here
    }
}

Note that a constructor is not a method that you can call anytime within a method. That's the reason you're getting errors in your call in the body.

Modify your constructor to the following so that it calls the base class constructor properly:

public MyExceptionClass(string message, string extrainfo) : base(message)
{
    //other stuff here
}

Note that a constructor is not a method that you can call anytime within a method. That's the reason you're getting errors in your call in the body.

Modify your constructor to the following so that it calls the base class constructor properly:

public class MyExceptionClass : Exception
{
    public MyExceptionClass(string message, string extrainfo) : base(message)
    {
        //other stuff here
    }
}

Note that a constructor is not a method that you can call anytime within a method. That's the reason you're getting errors in your call in the body.

Source Link
Jon Limjap
  • 95.7k
  • 15
  • 104
  • 153

Modify your constructor to the following so that it calls the base class constructor properly:

public MyExceptionClass(string message, string extrainfo) : base(message)
{
    //other stuff here
}

Note that a constructor is not a method that you can call anytime within a method. That's the reason you're getting errors in your call in the body.