У меня есть этот код для проверки класса Customer, созданного из службы WCF:
public partial class Customer : IDataErrorInfo
{
public string FirstName { get; set; }
public string LastName { get; set; }
public int Age { get; set; }
#region IDataErrorInfo Members
public string Error
{
get { throw new NotImplementedException(); }
}
public string this[string columnName]
{
get
{
string result = null;
if (columnName == "FirstName")
{
if (string.IsNullOrEmpty(FirstName))
result = "Please enter a First Name";
}
if (columnName == "LastName")
{
if (string.IsNullOrEmpty(LastName))
result = "Please enter a Last Name";
}
if (columnName == "Age")
{
if (Age < = 0 || Age >= 99)
result = "Please enter a valid age";
}
return result;
}
}
#endregion
}
Я получаю ошибку при определении this [string columnName], вероятно, потому что это частичный класс:
Member names cannot be the same as their enclosing type
Вы знаете, как я могу обойти эту проблему?