Click here to Skip to main content
15,890,123 members
Home / Discussions / C#
   

C#

 
AnswerRe: ExecuteNonQuery problem? Pin
Pete O'Hanlon19-Oct-10 22:04
mvePete O'Hanlon19-Oct-10 22:04 
QuestionAxWebBrowser object seems to be causing memory leak Pin
HalliHaida19-Oct-10 1:05
HalliHaida19-Oct-10 1:05 
AnswerRe: AxWebBrowser object seems to be causing memory leak PinPopular
Luc Pattyn19-Oct-10 1:39
sitebuilderLuc Pattyn19-Oct-10 1:39 
AnswerRe: AxWebBrowser object seems to be causing memory leak Pin
Pete O'Hanlon19-Oct-10 1:48
mvePete O'Hanlon19-Oct-10 1:48 
GeneralRe: AxWebBrowser object seems to be causing memory leak Pin
HalliHaida25-Oct-10 3:15
HalliHaida25-Oct-10 3:15 
QuestionMessage Removed Pin
18-Oct-10 22:11
Varun Sareen18-Oct-10 22:11 
AnswerRe: KeyValuePair List problem? Pin
OriginalGriff18-Oct-10 22:37
mveOriginalGriff18-Oct-10 22:37 
AnswerRe: KeyValuePair List problem? Pin
johannesnestler19-Oct-10 3:27
johannesnestler19-Oct-10 3:27 
I think this pattern is what you are looking for:

using System;
using System.Collections.Generic;

namespace KeyValuePair
{
    class Program
    {
        static void Main(string[] args)
        {
            List<KeyValuePair<string, string>> listImport = new List<KeyValuePair<string, string>>();
            listImport.Add(new KeyValuePair<string, string>("K1", "CCC"));
            listImport.Add(new KeyValuePair<string, string>("K2", "BBB"));
            listImport.Add(new KeyValuePair<string, string>("K3", "AAA"));
            listImport.Add(new KeyValuePair<string, string>("K4", "BBB"));
            listImport.Sort(delegate(KeyValuePair<string, string> first, KeyValuePair<string, string> second)
            {
                return first.Value.CompareTo(second.Value);
            });

            // We only need to "remember" the last value because the KeyValuePair list is sorted.
            string strLast = String.Empty;
            List<string> listDistinct = new List<string>();
            foreach (KeyValuePair<string, string> kvp in listImport)
            {
                if (strLast == kvp.Value)
                    continue;

                listDistinct.Add(kvp.Value);
                strLast = kvp.Value;
            }

            foreach (string str in listDistinct)
                Console.WriteLine(str);

            Console.ReadKey();
        }
    }
}

QuestionForm submit to server [modified] Pin
Ajay Kale New18-Oct-10 20:45
Ajay Kale New18-Oct-10 20:45 
AnswerRe: Form submit to server Pin
OriginalGriff18-Oct-10 22:38
mveOriginalGriff18-Oct-10 22:38 
Questionhow to get value from form 1 to form 2 Pin
ash_ng18-Oct-10 17:29
ash_ng18-Oct-10 17:29 
AnswerRe: how to get value from form 1 to form 2 Pin
JF201518-Oct-10 18:07
JF201518-Oct-10 18:07 
AnswerRe: how to get value from form 1 to form 2 Pin
Abhinav S18-Oct-10 18:27
Abhinav S18-Oct-10 18:27 
AnswerRe: how to get value from form 1 to form 2 Pin
Calla18-Oct-10 19:46
Calla18-Oct-10 19:46 
GeneralRe: how to get value from form 1 to form 2 Pin
ash_ng18-Oct-10 20:07
ash_ng18-Oct-10 20:07 
GeneralRe: how to get value from form 1 to form 2 Pin
Calla18-Oct-10 20:19
Calla18-Oct-10 20:19 
GeneralRe: how to get value from form 1 to form 2 Pin
DaveyM6919-Oct-10 0:04
professionalDaveyM6919-Oct-10 0:04 
AnswerRe: how to get value from form 1 to form 2 Pin
Varun Sareen18-Oct-10 22:26
Varun Sareen18-Oct-10 22:26 
GeneralRe: how to get value from form 1 to form 2 Pin
OriginalGriff18-Oct-10 23:44
mveOriginalGriff18-Oct-10 23:44 
AnswerRe: how to get value from form 1 to form 2 Pin
johannesnestler19-Oct-10 3:37
johannesnestler19-Oct-10 3:37 
AnswerRe: how to get value from form 1 to form 2 Pin
Jeff Connelly19-Oct-10 4:26
Jeff Connelly19-Oct-10 4:26 
QuestionWriting/show a Variable/Result into a XML File Pin
glenki18-Oct-10 12:10
glenki18-Oct-10 12:10 
AnswerRe: Writing/show a Variable/Result into a XML File Pin
Luc Pattyn18-Oct-10 13:02
sitebuilderLuc Pattyn18-Oct-10 13:02 
GeneralRe: Writing/show a Variable/Result into a XML File [modified] Pin
glenki18-Oct-10 13:17
glenki18-Oct-10 13:17 
GeneralRe: Writing/show a Variable/Result into a XML File Pin
Richard MacCutchan18-Oct-10 22:42
mveRichard MacCutchan18-Oct-10 22:42 

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.