How do I identify unique elements within my array in C#?
Let's say I work at the Dept. of Health. I've processed food poisoning
complaints and stored the complaints data into a multi-dimensional array
like so:
ID - 5 digit ID number for the restaurant victim ate at Date - Date of
Food Poisoning Name - Name of Victim Age - Age of Victim Phone - Victim's
Phone Number
Array[0] contains the first complaint's data. Array[0].ID contains the
restaurant ID of the first complaint and so forth.
Within my array how do I extract a list of unique 5 digit IDs?
Some restaurants might have 50 complaints and some might have just 1. I
want to create a list of all of the unique restaurant IDs that show up in
my complaints data.
var Unique = array.ID.Distinct();
does not work. What am I doing wrong?
No comments:
Post a Comment