c# - Best algorithm for age? -


I was wondering what would be the best way to search through the collection of these formats: < pre> public class person {date of birth date} set date}}

is my date of birth, i.e. 10/10/1943, now suppose I have one such The way that takes two parameters in this way:

  public IEnumerable & lt; Person & gt; SearchByAgeRange (Int AgeMin, Int AgeMax) {// Best algorithm goes here}   

There is a question of obtaining a collection of people to get people whose age passed as parameters Is between the maximum and the minimum integer?

Try it out: Public IEnumerable & lt; Person & gt; SearchByAgeRange (Int AgeMin, Int AgeMax) {// If the maximum age you are looking for, for example 80, you should look for the date that is equal to or equal to the current datename / mine 80 years. This is the date of the Minadet. DateTimeDate = Date Time.Now AddThis Year (-JJX); // If the minimum age is looking for you 40 for instace, then you should find the dates that are 40 years of current or decreasing time. // These make the maximum date DateTime maxDate = DateTime.Now add (-Ajmin); Return person Where (x => x.birthdate> = minutes and & amp; x.birthDate & lt; = maxDate); }

I think person has a collection of all people.

Comments

Post a Comment

Popular posts from this blog

jasper reports - How to center align barcode using jasperreports and barcode4j -

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -