private bool SearchFilter(object sender)
{
CommDGDataSource item = sender as CommDGDataSource;
if (FilterPropertyList.IsErrorFilter)
{
if (!item.Error)
return false;
}
if (FilterPropertyList.IsDestinationFilter)
{
if (!(item.Destination == FilterPropertyList.Destination))
return false;
}
if (FilterPropertyList.IsSourceFilter)
{
if (!(item.Source == FilterPropertyList.Source))
return false;
}
return true;
}
Above code works well but I was wondering if there is more of an elegant way to write the above code.
You can make a bit more readable by making small alterations as below