Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get all the females?

I would like to get the gender for calculations, for example the male and female options are in one column. I would like to get all male or all female for calculation.

I have a "computed property" which gives me list of all the items along with calculation. Here is the code:

partial void MeanFemale_Compute(ref string result)
{
    // Set result to the desired field value

    int totalAge = 0;
    int count = 0;

    foreach (InsuranceQuotation i in his.DataWorkspace.ApplicationData.InsuranceQuotations)
    {
        totalAge += i.mAge;
        count++;
    }

    if (count != 0)
    {
        result = (totalAge / count).ToString();
    }

}

How do I get to filter the gender in this "computed property".

like image 657
Xdrone Avatar asked Aug 04 '15 22:08

Xdrone


People also ask

How can I attract so many girls?

To attract girls, try to look your best, be kind, and be confident in yourself. Make sure you take care of your personal hygiene so you look and smell fresh. Wear clean clothes that you feel comfortable in and style your hair so it flatters your face and makes you feel confident.

How can I attract a girl towards me?

Make your intentions clear. You don't have to say something blunt like, "I want you." Casually interject that she is "good-looking," or "stunning," or something along those lines to show you find her attractive. Do this early on in your conversation so she knows what you are looking for. Touch her.


1 Answers

You can use LINQ. It would look something like this:

int averageAge =  this.DataWorkspace.ApplicationData.InsuranceQuotations.
    Where(iq => iq.Gender == Gender.Female).
    Average(iq => iq.mAge);
like image 85
DLCross Avatar answered Oct 25 '22 01:10

DLCross