Click here to Skip to main content
15,920,111 members
Home / Discussions / C#
   

C#

 
AnswerRe: Windows Services - FTP download Pin
Crevtout9811-Jun-07 19:49
Crevtout9811-Jun-07 19:49 
Questionhow to make an application so fast, in terms of speed Pin
devesh_code11-Jun-07 19:37
devesh_code11-Jun-07 19:37 
AnswerRe: how to make an application so fast, in terms of speed Pin
Christian Graus11-Jun-07 19:39
protectorChristian Graus11-Jun-07 19:39 
GeneralRe: how to make an application so fast, in terms of speed Pin
devesh_code11-Jun-07 19:50
devesh_code11-Jun-07 19:50 
AnswerRe: how to make an application so fast, in terms of speed Pin
Luc Pattyn12-Jun-07 0:58
sitebuilderLuc Pattyn12-Jun-07 0:58 
AnswerRe: how to make an application so fast, in terms of speed Pin
Hesham Yassin12-Jun-07 11:52
Hesham Yassin12-Jun-07 11:52 
GeneralRe: how to make an application so fast, in terms of speed Pin
devesh_code12-Jun-07 19:09
devesh_code12-Jun-07 19:09 
GeneralRe: how to make an application so fast, in terms of speed Pin
Hesham Yassin12-Jun-07 21:11
Hesham Yassin12-Jun-07 21:11 
there are many kinds of threads:
the basic one is :

<br />
private void MethodA()<br />
{<br />
     System.Threading.Thread t1 = new Thread(new ThreadStart(MethodB))<br />
     System.Threading.Thread t2 = new Thread(new ThreadStart(MethodC))<br />
<br />
}<br />
<br />
private void MethodB()<br />
{<br />
     // Do some work<br />
}<br />
private void MethodC()<br />
{<br />
     // Do some work<br />
}<br />


if the methods that you want to call have input, so you need to use a parametrized thread :

<br />
using System;<br />
using System.Threading;<br />
<br />
public class Work<br />
{<br />
    public static void Main()<br />
    {<br />
        // To start a thread using a shared thread procedure, use<br />
        // the class name and method name when you create the <br />
        // ParameterizedThreadStart delegate.<br />
        //<br />
        Thread newThread = new Thread(<br />
            new ParameterizedThreadStart(Work.DoWork));<br />
        <br />
        // Use the overload of the Start method that has a<br />
        // parameter of type Object. You can create an object that<br />
        // contains several pieces of data, or you can pass any <br />
        // reference type or value type. The following code passes<br />
        // the integer value 42.<br />
        //<br />
        newThread.Start(42);<br />
<br />
        // To start a thread using an instance method for the thread <br />
        // procedure, use the instance variable and method name when <br />
        // you create the ParameterizedThreadStart delegate.<br />
        //<br />
        Work w = new Work();<br />
        newThread = new Thread(<br />
            new ParameterizedThreadStart(w.DoMoreWork));<br />
        <br />
        // Pass an object containing data for the thread.<br />
        //<br />
        newThread.Start("The answer.");<br />
    }<br />
 <br />
    public static void DoWork(object data)<br />
    {<br />
        Console.WriteLine("Static thread procedure. Data='{0}'",<br />
            data);<br />
    }<br />
<br />
    public void DoMoreWork(object data)<br />
    {<br />
        Console.WriteLine("Instance thread procedure. Data='{0}'",<br />
            data);<br />
    }<br />
}<br />
<br />
/* This code example produces the following output (the order <br />
   of the lines might vary):<br />
<br />
Static thread procedure. Data='42'<br />
Instance thread procedure. Data='The answer'<br />
*/<br />
<br />


For more examples, search in the MSDN Library Wink | ;)
QuestionProblem with MailMerge Document Pin
Farhan Ali11-Jun-07 19:35
Farhan Ali11-Jun-07 19:35 
Questiontooltip on datagrid Pin
treah11-Jun-07 19:24
treah11-Jun-07 19:24 
Questionmove a button at runtime Pin
Keshav V. Kamat11-Jun-07 19:24
Keshav V. Kamat11-Jun-07 19:24 
AnswerRe: move a button at runtime Pin
Martin#11-Jun-07 19:31
Martin#11-Jun-07 19:31 
QuestionForm controls disappeared in VS 2005 Pin
Jack Valmadre11-Jun-07 18:47
Jack Valmadre11-Jun-07 18:47 
AnswerThe WOE!! Pin
Muammar©11-Jun-07 19:45
Muammar©11-Jun-07 19:45 
GeneralRe: The WOE!! Pin
Martin#11-Jun-07 20:00
Martin#11-Jun-07 20:00 
GeneralRe: The WOE!! Pin
Muammar©14-Jun-07 1:48
Muammar©14-Jun-07 1:48 
QuestionChanging the control size at run time Pin
Keshav V. Kamat11-Jun-07 18:41
Keshav V. Kamat11-Jun-07 18:41 
AnswerRe: Changing the control size at run time Pin
Sathesh Sakthivel11-Jun-07 18:44
Sathesh Sakthivel11-Jun-07 18:44 
GeneralRe: Changing the control size at run time Pin
Keshav V. Kamat11-Jun-07 18:50
Keshav V. Kamat11-Jun-07 18:50 
GeneralRe: Changing the control size at run time Pin
Sathesh Sakthivel11-Jun-07 18:55
Sathesh Sakthivel11-Jun-07 18:55 
QuestionHow to copy the folder in coding? Pin
sukirtha11-Jun-07 18:37
sukirtha11-Jun-07 18:37 
AnswerRe: How to copy the folder in coding? Pin
Sathesh Sakthivel11-Jun-07 18:42
Sathesh Sakthivel11-Jun-07 18:42 
QuestionRibbon Control Pin
wasife11-Jun-07 18:14
wasife11-Jun-07 18:14 
AnswerRe: Ribbon Control Pin
Sathesh Sakthivel11-Jun-07 18:36
Sathesh Sakthivel11-Jun-07 18:36 
GeneralRe: Ribbon Control Pin
wasife11-Jun-07 18:51
wasife11-Jun-07 18:51 

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.