You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm taking a look into it and may have found a way to implement it. But, as I'm still not sure of it, would you mind helping me think of examples where that approach would be useful? I'm struggling a bit to find valid test cases that I could use.
The best that I could come up with so far was this:
varcompany=new Person.Company {Name="Back to the future",Industry="Time Traveling Agency"};People=newList<Person>{new Person {Name="John Doe",Gender= PersonGender.Male,Birth=new Person.BirthData {Date=new DateTime(1979,2,28),Country="USA"},Employer=company},new Person {Name="Jane Doe",Gender= PersonGender.Female,Birth=new Person.BirthData {Date= DateTime.Now.AddYears(-16),Country=""}},new Person {Name="Wade Wilson",Gender= PersonGender.Male,Birth=new Person.BirthData {Date=new DateTime(1973,10,9),Country="USA"}},new Person {Name="Jessica Jones",Gender= PersonGender.Female,Birth=new Person.BirthData {Date= DateTime.Now.AddYears(-16),Country="USA"}},new Person {Name="Jane Jones",Gender= PersonGender.Female,Birth=new Person.BirthData {Date=new DateTime(1980,12,20),Country="USA"}},new Person {Name="Fulano Silva",Gender= PersonGender.Male,Birth=new Person.BirthData {Date=new DateTime(1983,5,10),Country="BRA"},Employer=company},new Person {Name="Fulana da Silva",Gender= PersonGender.Male,Birth=new Person.BirthData {Date= DateTime.Now.AddYears(-16),Country="BRA"}},new Person {Name="John Hancock",Gender= PersonGender.Male,Employer=company}};vareighteenYearsAgo= DateTime.Now.AddYears(-18);//Selecting people younger than 18 years in USA and older than 18 in BRA at once
People.Where(p =>((p.Birth !=null&& p.Birth.Date !=null&& p.Birth.Date >eighteenYearsAgo)&& p.Birth.Country =="USA")||((p.Birth !=null&& p.Birth.Date !=null&& p.Birth.Date <eighteenYearsAgo)&& p.Birth.Country =="BRA"));
What do you reckon? Could you think of something else?
I uploaded a release candidate version to NuGet today that finally has support for "complex expressions" (parentheses handling).
If you add the reference through the "Manage NuGet packages" option in Visual Studio, don't forget to tick the "Include prerelease" option (otherwise, this version won't be listed).
Hey Dave,
Nice little library. Just wondering how you would approach building in parenthesis?
The text was updated successfully, but these errors were encountered: