c# - Best algorithm for age? -
I was wondering what would be the best way to search through the collection of these formats: < pre> 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: 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: I think public class person {date of birth date} set date}}
public IEnumerable & lt; Person & gt; SearchByAgeRange (Int AgeMin, Int AgeMax) {// Best algorithm goes here}
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); }
person has a collection of all people.
csharp कोड उदाहरण
ReplyDeleteComboBox से चयनित आइटम प्राप्त करें