I'm trying to use a dictionary in c# as follows
and seems to be the declaration and initialization are ok .
Then I create an instance of
where Orderstore implements the IStorage and Order implements IEntity.
But when I try to add Orderstore to the dictionary it says "Argument type Orderstore is not assignable to parameter type IStorage"
I wonder anyone can help me with this. Thanks in advance.
15 Jan '13 - 18:23
Edited 15 Jan '13 - 22:18
Use the code given below:
If myOrders is the name of the dictionary, then use
Orderstore order = myOrders[index] as Orderstore;
TypeCast it "as OrderSto0re" then your code will work.
15 Jan '13 - 19:55
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)