Question: I am having trouble with a generic type constraint. I have the below method, and im struggling to pass anything into the childSegments parameter, the first parameter i can get round.

```
private void FillSegment<T, TT>(BaseSegment<T> segment, IEnumerable<BaseSegment<TT>> childSegments)
        where T : class
        where TT : class
    {}

```

TT is of type class, but the list im trying to pass in, should be a combination of different classes not just a single class type, that's the wall i am hitting. I could just pass in this list: 

`List<BaseSegment<Lead>> l = new List<BaseSegment<Lead>>();` 

but like i said, i need to pass in multiple classes, i have a LeadSegment, AccountSegment, ContactSegment etc (which implement `BaseSegment<T>`).

The ideal scenario would be something like this:

```
List<BaseSegment<T>> lst = new List<BaseSegment<T>>();
lst.Add(LeadSegment);
lst.Add(AccountSegment);
lst.Add(ContactSegment);

```

..and pass that, but you cannot create a list with a `<T>` type within a method or outside i believe

Any Ideas?

Thanks

Answer: 
Make `BaseSegment` a non-generic abstract class (you don't ever instantiate `BaseSegment` directly do you?). Your signature for `FillSegment` could then look like this:

```
private void FillSegment<TParent>(TParent parent, IEnumerable<BaseSegment> children)
    where TParent : BaseSegment

```

This enables you to consume the method like this:

```
var parent = new SomeParentSegment(); // SomeParentSegment derives from BaseSegment
var children = new List<BaseSegment>();
children.Add(new LeadSegment()); // LeadSegment derives from BaseSegment
children.Add(new AccountSegment()); // AccountSegment derives from BaseSegment
children.Add(new ContactSegment()); // ContactSegment derives from BaseSegment

FillSegment(parent, children);

```

Note that this allows `children` to be of the same type as `parent`, given that both instances derive from `BaseSegment`.
I'm having a little trouble following what you are wanting to do, but I think you want to make your constraints 

```
where TT : T

```

or...

```
where TT : BaseSegment<T>

```

Both of these scenarios enable your "Ideal scenario" above; but without a further understanding...