ValidateIPAddress.cs - constructor correct?

 
50   50
Jun 08, 2011
 
Hi, 

Can someone please confirm whether the second constructor in the following codefile (ValidateIPAddress.cs, from Patterns in action 4.0) is correct?
//ValidateIPAddress.cs:


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace BusinessObjects.BusinessRules
{
    /// <summary>    
    /// IP Address validation rule.    
    /// </summary>    
    public class ValidateIPAddress : ValidateRegex
    {
        // Match IP Address
        public ValidateIPAddress(string propertyName) :
            base(propertyName, @"^([0-2]?[0-5]?[0-5]\.){3}[0-2]?[0-5]?[0-5]$")
        {
            ErrorMessage = propertyName + " is not a valid IP Address";
        }

        public ValidateIPAddress(string propertyName, string errorMessage) :
            this(propertyName)
        {
            ErrorMessage = errorMessage;
        }
    }
}

 



810   99.9
Jun 08, 2011
Hello Ole Johnny:

The second (overloaded) constructor seems fine to me.
Is there any particular reason why you think it is not correct or obsolete?