Click here to Skip to main content
13,148,503 members (51,058 online)
Rate this:
Please Sign up or sign in to vote.
See more:
Hi ,

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<order>"
I wonder anyone can help me with this. Thanks in advance.
Posted 15-Jan-13 18:23pm
Updated 15-Jan-13 22:18pm
I cannot believe that exception message contains the words "return of the Dictionary", as they make no sense.
It may work out if you show the minimal code sample. Show how you initialize key and value object and add a dictionary element to it.
Suvabrata Roy 16-Jan-13 4:54am
Please share the order class and some code ...
Sergey Alexandrovich Kryukov 16-Jan-13 14:10pm
You are right, but better reply to OP's post, not mine. Not a problem though...
Suvabrata Roy 16-Jan-13 23:26pm
OP's Post mean ...?
Sergey Alexandrovich Kryukov 16-Jan-13 23:42pm
Oh, sorry for this abbreviation; it's just the jargon we use on this site, which as not very good, as many don't know it. OP means "Original Poster" or "Original Publisher", something like that, in this case, prasadbuddhika.
Suvabrata Roy 16-Jan-13 23:47pm
Ok, I understand :)

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Use the code given below:

Dictionary<type,isynchronizedstorage><isynchronizableentity>> myOrders;

If myOrders is the name of the dictionary, then use

Orderstore<order> order = myOrders[index] as Orderstore;

TypeCast it "as OrderSto0re" then your code will work.


This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web04 | 2.8.170924.2 | Last Updated 16 Jan 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100