I
intrader
The code is:
<code>
namespace ConsoleApp
{
public interface Ivalidator{
String ErrorMessage{get;}
Boolean IsValid{get;}
void Validate(string value,long mask,
long maxLength,string dispName,string sExtra);
}
public class Validator:IValidator{
private String _errorMessage="";
private Boolean _isValid=false;
public String ErrorMessage{get{return _errorMessage;}}
public Boolean IsValid{get{return _isValid;}}
public void Validate(string value,long mask,
long maxLength,string dispName,string sExtra)
}
static class CValidator:ValidatorBase{}
///This gives me an error at this point stating "A namespace does not
///directly contain members such as fields or method"
class ValidatorBaseTest{
static void Main(string[] args){}
}
}
</code>
Here I trying to build a static class that provide validation for an
incoming value and metadata provided in the Validate call.
The message puzzles me "... does not..." implies that what the problem
is that I don't have any fields or methods directly in the namespace; if
I supply them, I get yet more errors, so that is not the problem.
I can write
<code>
class CValidator:ValidatorBase{
public static void Validate((string value,long mask,
long maxLength,string dispName,string sExtra){}
}
</code>
Is it not the same thing?
Why the error when I use 'static class ...'
Thanks
<code>
namespace ConsoleApp
{
public interface Ivalidator{
String ErrorMessage{get;}
Boolean IsValid{get;}
void Validate(string value,long mask,
long maxLength,string dispName,string sExtra);
}
public class Validator:IValidator{
private String _errorMessage="";
private Boolean _isValid=false;
public String ErrorMessage{get{return _errorMessage;}}
public Boolean IsValid{get{return _isValid;}}
public void Validate(string value,long mask,
long maxLength,string dispName,string sExtra)
}
static class CValidator:ValidatorBase{}
///This gives me an error at this point stating "A namespace does not
///directly contain members such as fields or method"
class ValidatorBaseTest{
static void Main(string[] args){}
}
}
</code>
Here I trying to build a static class that provide validation for an
incoming value and metadata provided in the Validate call.
The message puzzles me "... does not..." implies that what the problem
is that I don't have any fields or methods directly in the namespace; if
I supply them, I get yet more errors, so that is not the problem.
I can write
<code>
class CValidator:ValidatorBase{
public static void Validate((string value,long mask,
long maxLength,string dispName,string sExtra){}
}
</code>
Is it not the same thing?
Why the error when I use 'static class ...'
Thanks