Click here to Skip to main content
15,887,349 members
Home / Discussions / C#
   

C#

 
GeneralRe: How to run windows application on image button click from web page Pin
AtulRane4-Sep-08 23:48
AtulRane4-Sep-08 23:48 
GeneralRe: How to run windows application on image button click from web page Pin
Ashfield5-Sep-08 1:20
Ashfield5-Sep-08 1:20 
GeneralRe: How to run windows application on image button click from web page Pin
AtulRane5-Sep-08 3:30
AtulRane5-Sep-08 3:30 
QuestionMerge to xml-files by C# Pin
Tomerland4-Sep-08 23:08
Tomerland4-Sep-08 23:08 
AnswerRe: Merge to xml-files by C# Pin
buchstaben5-Sep-08 2:00
buchstaben5-Sep-08 2:00 
Questionhow to get last file_size of updated file Pin
reza assar4-Sep-08 22:41
reza assar4-Sep-08 22:41 
AnswerRe: how to get last file_size of updated file Pin
#realJSOP5-Sep-08 0:14
mve#realJSOP5-Sep-08 0:14 
QuestionProblems Using ToDictionary Extension Method Pin
dlarkin774-Sep-08 22:39
dlarkin774-Sep-08 22:39 
Hi,

I have a dictionary of items. I want to create a new Dictionary by taking items from it where each item meets a particular criterion. I figure that the ToDictionary extension method would suit my purpose, but for the life of me I cannot get it to compile.

<pre>
Dictionary<int, string> test = new Dictionary<int, string>{
{1 ,"a"},{2, "b"},{3 ,"c"},{4, "d"}
};

Dictionary<int, string> d = test.ToDictionary<int, string>(o => o.Value.CompareTo("d") == -1);
// compiler error on this line
//'System.Collections.Generic.Dictionary<int,string>' does not contain a definition for 'ToDictionary' and the best extension method overload //'System.Linq.Enumerable.ToDictionary<TSource,TKey>(System.Collections.Generic.IEnumerable<TSource>, System.Func<TSource,TKey>)' has some //invalid arguments
</pre>

The only thing that I could manage that came close to what I need is:

<pre>
List<KeyValuePair<int, string>> t1 = test
.Where(o => o.Value.CompareTo("d") == -1)
.ToList<KeyValuePair<int, string>>();
</pre>

I reckon I'm doing something really stupid but I can't see what it is. Can anyone help me out?

Thanks very much,

dlarkin77
AnswerRe: Problems Using ToDictionary Extension Method Pin
User 66584-Sep-08 23:06
User 66584-Sep-08 23:06 
GeneralRe: Problems Using ToDictionary Extension Method Pin
dlarkin774-Sep-08 23:31
dlarkin774-Sep-08 23:31 
QuestionTransfer data from excelsheet to datatable Pin
abhijitjathar4-Sep-08 22:32
abhijitjathar4-Sep-08 22:32 
AnswerRe: Transfer data from excelsheet to datatable Pin
Manas Bhardwaj4-Sep-08 22:38
professionalManas Bhardwaj4-Sep-08 22:38 
AnswerRe: Transfer data from excelsheet to datatable Pin
Morven Huang4-Sep-08 23:03
Morven Huang4-Sep-08 23:03 
QuestionBinding cutsom type value to Control Pin
El'Cachubrey4-Sep-08 22:00
El'Cachubrey4-Sep-08 22:00 
AnswerRe: Binding cutsom type value to Control Pin
Dave Sexton4-Sep-08 22:24
Dave Sexton4-Sep-08 22:24 
QuestionA queue of paired values Pin
Angelinna4-Sep-08 21:53
Angelinna4-Sep-08 21:53 
AnswerRe: A queue of paired values [modified] Pin
#realJSOP5-Sep-08 0:16
mve#realJSOP5-Sep-08 0:16 
AnswerRe: A queue of paired values Pin
S. Senthil Kumar6-Sep-08 7:19
S. Senthil Kumar6-Sep-08 7:19 
QuestionExporting function from a C# dll with __stdcall calling convention Pin
Nyarlatotep4-Sep-08 21:44
Nyarlatotep4-Sep-08 21:44 
AnswerRe: Exporting function from a C# dll with __stdcall calling convention Pin
mav.northwind4-Sep-08 22:58
mav.northwind4-Sep-08 22:58 
GeneralRe: Exporting function from a C# dll with __stdcall calling convention Pin
Nyarlatotep4-Sep-08 23:09
Nyarlatotep4-Sep-08 23:09 
GeneralRe: Exporting function from a C# dll with __stdcall calling convention Pin
mav.northwind5-Sep-08 1:08
mav.northwind5-Sep-08 1:08 
QuestionSource code to convert Foxpro to MS Access Databse Pin
pavanip4-Sep-08 20:34
pavanip4-Sep-08 20:34 
AnswerRe: Source code to convert Foxpro to MS Access Databse Pin
Vimalsoft(Pty) Ltd4-Sep-08 20:41
professionalVimalsoft(Pty) Ltd4-Sep-08 20:41 
Questionshort cut key for tabpages of tabcontrol Pin
Anu Palavila4-Sep-08 20:12
Anu Palavila4-Sep-08 20:12 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.