Jim
Jim

Reputation: 3

Syntax help required

Can someone help with the following:

CollectionView.Filter = m => ((Customer)m).Name.ToLower().Contains(_lastNameFilter);

Instead of looking up name, I'd to search DateAdded = _filterDate

Upvotes: 0

Views: 87

Answers (3)

J.N.
J.N.

Reputation: 8431

With the assumption that _filterDate is a string and DateAdded a Date CollectionView.Filter = m => ((Customer)m).DateAdded == DateTime.Parse(_filterDate);

Upvotes: 1

Justin Niessner
Justin Niessner

Reputation: 245489

It looks like it should be:

CollectionView.Filter = m => 
    ((Customer)m).DateAdded == DateTime.Parse(_filterDate);

Upvotes: 1

Daniel Hilgarth
Daniel Hilgarth

Reputation: 174457

I don't know how CollectionView.Filter works, but why don't you just use this:

CollectionView.Filter = m => ((Customer)m).DateAdded == _filterDate;

Upvotes: 2

Related Questions