Click here to Skip to main content
15,914,013 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
XML
Hi--

How to cast given below dictionaryCollection to IList<Isomething> ?

public IList<ISomething> FetchAll(Object obj1, Object obj2)
{
   var dictCollection = Cache.GetAll(IsCacheMiss(obj1, obj2)),key).ToList();
   IList<ISomething> isomething = ???? How to cast here ???

}

//Implementation of GetAll method
public DictionaryCollection<Tid, Tvalue> GetAll(Func<IEnumerable<TValue>>IsCacheMiss, Func<TValue, TId> key)
{
  code...
  Code...
}
Posted
Updated 7-Aug-13 17:05pm
v2
Comments
Sergey Alexandrovich Kryukov 7-Aug-13 23:17pm    
What is dictionaryCollection? Where is the declaration of the generic type DictionaryCollection?
—SA
BobCasting 7-Aug-13 23:50pm    
public DictionaryCollection<tid,tvalue> GetAll(Func<ienumerable<tvalue>>IsCacheMiss, Func<tvalue, tid=""> key)
{
code...
Code...
}
Sergey Alexandrovich Kryukov 8-Aug-13 0:15am    
Not enough. Isn't it obvious?
Now, if this class is not implementing IList, cast is impossible. You need to have a method like ToList which creates the instance of System.Generic.List and copies some items in a loop. That's all.
—SA
BobCasting 8-Aug-13 11:27am    
thanks-SA !

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900