Hi,
I have two lists based on the same class. I would like one list to inherit the values of the other list's class properties.
class feature {
Guid id;
string featureName;
string featureType;
.....
}
List <feature> companyFeatures;
List <feature> divisionFeatures;
The list of features is set at the company level.
When a division is created it should inherit all of the features from the company feature list. (Not copy)
If the division has a different property value in a specific feature than that of the company , the user wants to "save" this property's value in the division's feature list.
This gives the user the ability to add features at a later date at the company level and see these new features at the division level.
Usually there will not be many items in the division list as they are the same as the company list.
I have tried to join both lists using linq (an outer join). It seems to fail when there is no entry for a list element at the division level.
I guess I am doing something wrong (I might not understand outer joins correctly) Any help will be appreciated.
By the way is there a design pattern recommended for implementing inheritance.
Be happy and have a wonderful day
================================================================================
Adding an example (Hopefully this will clarify my objective)
List <feature> companyFeatures = new List <feature>
{
new <feature> { Guid1 , "Color" , "Text" , .... },
new <feature> { Guid2 , "address" , "Link" , .... },
new <feature> { Guid3 , "logo" , "Picture" , .... }
}
List <feature> divisionFeatures = new List <feature>
{
new <feature> { Guid2 , "address" , "text" , .... },
}
The feature list I am looking for after the "inheritance" should be:
{
{Guid1, "Color" , "Text" , ...},
{Guid2, "address" , "text" , ...},
{Guid3, "logo" , "Picture" , ...}
}
Note that Guid2 now has a value of text for the type property. Hope this clarifies.