asp.net extension for concurrentDictionary

Colanth

New Member
I just recently upgraded this project from ASP.Net 3.5 to 4.0 so that I could use the concurrentDictionary instead of Dictionary because of the thread safe feature.To use it I created an extension using code found in help forums.It is all very close to working and I don't know how I can modify the extension for it to work properly.Here is the code:\[code\]var catalogs = (from _catalog in entities.catalogs from rolePermission in entities.c_roleperm from _group in entities.c_group from _user in entities.c_user where _group.id == rolePermission.groupID && rolePermission.roleID == user.roleID && _catalog.groupID == rolePermission.groupID && _user.id == _catalog.userID select new { name = _catalog.name, groupID = _catalog.groupID, userName = _user.name, userID = _catalog.userID, groupName = _group.name, ID = _catalog.id } );var listItems = catalogs.ToList(p => new CatalogItem() { name = p.name, groupID = p.groupID, userID = p.userID, username = p.userName, groupName = p.groupName, ID = p.ID }).GroupBy(p => p.groupName).ToConcurrentDictionary(p => p.Key, p => p.ToList());\[/code\]And the code in the extension:\[code\]public static class Extentions{ public static ConcurrentDictionary<TKey, TValue> ToConcurrentDictionary<TKey, TValue>( this IEnumerable<KeyValuePair<TKey, TValue>> source) { return new ConcurrentDictionary<TKey, TValue>(source); } public static ConcurrentDictionary<TKey, TValue> ToConcurrentDictionary<TKey, TValue>( this IEnumerable<TValue> source, Func<TValue, TKey> keySelector) { return new ConcurrentDictionary<TKey, TValue>( from v in source select new KeyValuePair<TKey, TValue>(keySelector(v), v)); }\[/code\]And this is the error that I receive:Error 1 No overload for method 'ToConcurrentDictionary' takes 2 argumentsWhat would I need to modify for the extension to work in this situation? Any suggestions are greatly appreciated.
 
Back
Top