构造函数参数验证的最佳实践是什么?
假设有一个简单的C#:
public class MyClass
{
    public MyClass(string text)
    {
        if (String.IsNullOrEmpty(text))
            throw new ArgumentException("Text cannot be empty");
        // continue with normal construction
    }
}
抛出异常是否可以接受?
我遇到的替代方法是在实例化之前进行预验证:
public class CallingClass
{
    public MyClass MakeMyClass(string text)
    {
        if (String.IsNullOrEmpty(text))
        {
            MessageBox.Show("Text cannot be empty");
            return null;
        }
        else
        {
            return new MyClass(text);
        }
    }
}