Click here to Skip to main content
15,888,461 members
Home / Discussions / C#
   

C#

 
QuestionHow can I dynamically name and instantiate List<string> lists? Pin
turbosupramk330-Jan-15 4:56
turbosupramk330-Jan-15 4:56 
AnswerRe: How can I dynamically name and instantiate List<string> lists? Pin
BillWoodruff30-Jan-15 5:05
professionalBillWoodruff30-Jan-15 5:05 
GeneralRe: How can I dynamically name and instantiate List<string> lists? Pin
turbosupramk330-Jan-15 5:11
turbosupramk330-Jan-15 5:11 
GeneralRe: How can I dynamically name and instantiate List<string> lists? Pin
BillWoodruff30-Jan-15 6:12
professionalBillWoodruff30-Jan-15 6:12 
GeneralRe: How can I dynamically name and instantiate List<string> lists? Pin
turbosupramk32-Feb-15 3:48
turbosupramk32-Feb-15 3:48 
AnswerRe: How can I dynamically name and instantiate List<string> lists? Pin
OriginalGriff30-Jan-15 5:36
mveOriginalGriff30-Jan-15 5:36 
GeneralRe: How can I dynamically name and instantiate List<string> lists? Pin
turbosupramk32-Feb-15 3:51
turbosupramk32-Feb-15 3:51 
GeneralRe: How can I dynamically name and instantiate List<string> lists? Pin
OriginalGriff2-Feb-15 5:07
mveOriginalGriff2-Feb-15 5:07 
Passing a value into a Thread is pretty easy:
C#
    Thread t = new Thread(DoWork);
    t.Start("hello there");
    }

private void DoWork(object o)
    {
    string s = o as string;
    if (s != null)
        {
        Console.WriteLine(s);
        }
    }
Getting a return value is a lot harder!

If I needed a return value, I'd probably do it via a BackgroundWorker instead of a Thread, because that makes it really easy:
C#
    BackgroundWorker work = new BackgroundWorker();
    work.DoWork += work_DoWork;
    work.RunWorkerCompleted += work_RunWorkerCompleted;
    work.RunWorkerAsync("hello There");
    }

private void work_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
    {
    Console.WriteLine(e.Result);
    }

private void work_DoWork(object sender, DoWorkEventArgs e)
    {
    string s = e.Argument as string;
    if (s != null)
        {
        Console.WriteLine(s);
        }
    e.Result = string.Format("{0}: Complete", e.Argument);
    }

Because Argument and Result are both objects, you can pass any type you like in and out.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...

QuestionImprove OCR program Pin
rosy8430-Jan-15 4:55
rosy8430-Jan-15 4:55 
AnswerRe: Improve OCR program Pin
Eddy Vluggen30-Jan-15 5:16
professionalEddy Vluggen30-Jan-15 5:16 
AnswerRe: Improve OCR program Pin
rosy8430-Jan-15 5:36
rosy8430-Jan-15 5:36 
GeneralRe: Improve OCR program Pin
Eddy Vluggen30-Jan-15 7:19
professionalEddy Vluggen30-Jan-15 7:19 
GeneralRe: Improve OCR program Pin
rosy8430-Jan-15 12:26
rosy8430-Jan-15 12:26 
AnswerRe: Improve OCR program Pin
rosy847-Feb-15 22:38
rosy847-Feb-15 22:38 
QuestionHow to share a DLL between two applications? Pin
JBHowl30-Jan-15 4:54
JBHowl30-Jan-15 4:54 
QuestionRe: How to share a DLL between two applications? Pin
Eddy Vluggen30-Jan-15 5:13
professionalEddy Vluggen30-Jan-15 5:13 
AnswerRe: How to share a DLL between two applications? Pin
JBHowl30-Jan-15 5:15
JBHowl30-Jan-15 5:15 
GeneralRe: How to share a DLL between two applications? Pin
Eddy Vluggen30-Jan-15 5:38
professionalEddy Vluggen30-Jan-15 5:38 
AnswerRe: How to share a DLL between two applications? Pin
manchanx30-Jan-15 5:13
professionalmanchanx30-Jan-15 5:13 
GeneralRe: How to share a DLL between two applications? Pin
JBHowl30-Jan-15 5:15
JBHowl30-Jan-15 5:15 
GeneralRe: How to share a DLL between two applications? Pin
manchanx30-Jan-15 5:44
professionalmanchanx30-Jan-15 5:44 
AnswerRe: How to share a DLL between two applications? Pin
Richard Andrew x6430-Jan-15 5:24
professionalRichard Andrew x6430-Jan-15 5:24 
GeneralRe: How to share a DLL between two applications? Pin
JBHowl30-Jan-15 5:31
JBHowl30-Jan-15 5:31 
GeneralRe: How to share a DLL between two applications? Pin
Richard Andrew x6430-Jan-15 5:46
professionalRichard Andrew x6430-Jan-15 5:46 
AnswerRe: How to share a DLL between two applications? Pin
Gerry Schmitz30-Jan-15 10:32
mveGerry Schmitz30-Jan-15 10:32 

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.