I have an IList that pretty much emulates the following table:

| Code | Year | Type | Value | Active | Paid |
| --- | --- | --- | --- | --- | --- |
| ABC | 2009 | Lic | NULL | True | 3.12 |
| ABC | 2009 | Car | Audi | True | 4.63 |
| ABC | 2010 | Lic | Learner | True | 5.41 |
| ABC | 2011 | Lic | Full | True | 7.82 |
| ABC | 2011 | Car | Honda | True | 5.19 |
| ABC | 2012 | Lic | Expired | True | 10.50 |
| ABC | 2013 | Lic | NULL | True | 15.71 |
| XYZ | 2009 | Lic | NULL | True | 4.63 |
| XYZ | 2010 | Lic | Full | True | 6.90 |
| XYZ | 2010 | Car | Mazda | True | 4.29 |
| XYZ | 2011 | Lic | Full | True | 9.73 |
| XYZ | 2011 | Car | Mazda | True | 9.17 |

Each Code will have multiple Types, each with annual data. The amount of annual data for different Types for a single Code may differ.

I'm bringing it into a method as variable yv.

I have the following code to obtain the range of years of data, but I want to exclude those where Lic = NULL and the below returns all years in the DB. I'll later use the valid (Lic != NULL) years to do other calculations.

Also, advice on how to store the valid years so that they can be accessed by other methods doing other calculations that only need the valid years' data would also be appreciated. I'm out of my depth on this one.

```
public decimal RegoCosts(IList<YearlyValuesTable> yv) 
{
  IList<string> years = yv.Select(x => x.Year).Distinct().ToList();
  // other magic not relevant to this question
  return avePaidYearly;
}

```

Thanks