publicclass Contact : IDataErrorInfo { privatestring _firstName; privatestring _lastName; publicstring FirstName { get { return _firstName; } set { _firstName = value; } } publicstring LastName { get { return _lastName; } set { _lastName = value; } } #region IDataErrorInfo Memberspublicstring Error { get { thrownew NotImplementedException(); } } publicstringthis[string columnName] { get { string result =null; if( columnName =="FirstName" ) { if (String.IsNullOrEmpty( FirstName) ) result ="Firstname has to be set!"; elseif (FirstName.Length <5) result ="Firstname's length has to be at least 5 characters!"; } elseif (columnName =="LastName") { if (String.IsNullOrEmpty(LastName)) result ="LastName has to be set!"; elseif (LastName.Length <5) result ="LastName's length has to be at least 5 characters!"; } return result; } } #endregion }