I follow a convention that I won\'t use any print statements in classes, but I have done a parameter validation in a constructor. Please tell me how to return that validatio
Constructors do not have a return type, but you can pass values by reference using the ref keyword. It would be better to throw an exception from the constructor to indicate a validation failure.
public class YourClass
{
public YourClass(ref string msg)
{
msg = "your message";
}
}
public void CallingMethod()
{
string msg = string.Empty;
YourClass c = new YourClass(ref msg);
}