I've been trying to write my own custom constructor, but getting error about base()
constructor. I've also been searching how to solve this error, but found nothing and all the examples round the internet are showing almost the same code as mine.
Whole Exception.cs content:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace RegisService
{
public class Exceptions : Exception
{
}
public class ProccessIsNotStarted : Exceptions
{
ProccessIsNotStarted()
: base()
{
//var message = "Formavimo procesas nestartuotas";
//base(message);
}
ProccessIsNotStarted(string message)
: base(message) {}
ProccessIsNotStarted(string message, Exception e)
: base(message, e) {}
}
}
first overload with base()
is working, no errors were thrown. Second and the third
overloads are telling me that :
"RegisService.Exceptions does not contain a constructor that takes 1(2) arguments"
One more way I've been trying to solve the error:
ProccessIsNotStarted(string message)
{
base(message);
}
ProccessIsNotStarted(string message, Exception e)
{
base(message, e);
}
this time, VS is telling me that:
"Use of keyword 'base' is not valid in this context"
So, where is the problem? Looks like the base()
constructor has some weird overloads or I'm calling it in inappropriate way?