Hi,
I have a class as follows :-
interface IFilterCondition
{
List<Name> ApplyFilter(List<Name> namesToFilter);
}
class FilterName : IFilterCondition
{
public NameFilterEnum NameFilterEnum{ get; set; }
public List<Name> ExcludeList { get; set; }
public char StartCharacter{ get; set; }
#region IFilterCondition Members
public List<Name> ApplyFilter(List<Name> namesToFilter)
{
switch (NameFilterEnum)
{
case NameFilterEnum.FilterFirstName:
// Check Exclude List
// Check Start Character
break;
case NameFilterEnum.FilterLastName:
// Check Exclude List only
break;
default:
break;
}
return namesToFilter;
}
#endregion
}
enum NameFilterEnum
{
None,
FilterFirstName,
FilterLastName
}
Note that only if it is flagged as a FilterFirstName then it will require the StartCharacter property.
Is the above correct or should I separate out FirstName filter and LastName filter as they require different properties? Coz I think in this instance, some business rules needs to be enforced when inputing data to this class.
Please advice, Thanks