Views: 6.5K
Replies: 1
Archived
|
ValidateIPAddress.cs - constructor correct?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; } } } Ole Johnny Gjen, Jun 08, 2011
|
|
Reply 1Hello Ole Johnny:
The second (overloaded) constructor seems fine to me. Is there any particular reason why you think it is not correct or obsolete? Dan McMillan, Jun 08, 2011
|