Click here to Skip to main content
15,900,110 members
Home / Discussions / C#
   

C#

 
GeneralRe: Something wrong with my binding to datagird. Pin
lordjpg12-Mar-04 15:30
lordjpg12-Mar-04 15:30 
GeneralAdding an Interface to my user controls Pin
TriBoy12-Mar-04 11:05
TriBoy12-Mar-04 11:05 
GeneralRe: Adding an Interface to my user controls Pin
John Fisher12-Mar-04 11:31
John Fisher12-Mar-04 11:31 
GeneralRemoting - instantiating a wellknown type Pin
Judah Gabriel Himango12-Mar-04 9:16
sponsorJudah Gabriel Himango12-Mar-04 9:16 
GeneralRe: Remoting - instantiating a wellknown type Pin
Heath Stewart12-Mar-04 10:29
protectorHeath Stewart12-Mar-04 10:29 
GeneralRe: Remoting - instantiating a wellknown type Pin
Judah Gabriel Himango12-Mar-04 11:03
sponsorJudah Gabriel Himango12-Mar-04 11:03 
GeneralRe: Remoting - instantiating a wellknown type Pin
Heath Stewart12-Mar-04 15:42
protectorHeath Stewart12-Mar-04 15:42 
QuestionIs there actually a difference (speed gain etc) ? Pin
Andres Coder12-Mar-04 8:05
Andres Coder12-Mar-04 8:05 
Look at the code: the are two similar methods. One declares all variables used in the method at the start of the method, the other one declares them when it needs then. May there be any lower CPU or memory cost in the second version of the method (the one at the bottom) ?

<br />
public void DoSomethingComplex(...)<br />
{<br />
    // Declare all variables at the beginning of the method<br />
    int[] intarray = new ...<br />
    bool somecondition = ...<br />
    // If this condition return false, intarray is never used<br />
    if (somecondition == true)<br />
        intarray[1].Add ... // Do stuff with the variable<br />
}<br />
<br />
public void DoSomethingComplex(...)<br />
{<br />
    // Declare only variables that we need through the whole function,<br />
    // not temporary ones or something like that ...<br />
    bool somecondition = ...<br />
    if (somecondition == true)<br />
    {<br />
        // Declare variable now as we are sure that we are going to<br />
        // use it. CPU or memory saving if somecondition returns false ?<br />
        int[] intarray = new ...<br />
        intarray[1].Add ... // Do stuff with the variable<br />
    }<br />
} 


Regards, Desmond
AnswerRe: Is there actually a difference (speed gain etc) ? Pin
Jeff Varszegi12-Mar-04 8:29
professionalJeff Varszegi12-Mar-04 8:29 
AnswerRe: Is there actually a difference (speed gain etc) ? Pin
HAHAHA_NEXT12-Mar-04 10:08
HAHAHA_NEXT12-Mar-04 10:08 
AnswerRe: Is there actually a difference (speed gain etc) ? Pin
Adrian Stanley13-Mar-04 0:31
Adrian Stanley13-Mar-04 0:31 
GeneralTextBox Access Pin
jmandile12-Mar-04 7:57
sussjmandile12-Mar-04 7:57 
GeneralRe: TextBox Access Pin
Dave Kreskowiak12-Mar-04 10:21
mveDave Kreskowiak12-Mar-04 10:21 
GeneralI want to write a application like Microsoft's PowerPoint User interface... Pin
aoyee12-Mar-04 6:49
aoyee12-Mar-04 6:49 
GeneralRe: I want to write a application like Microsoft's PowerPoint User interface... Pin
Mazdak12-Mar-04 7:18
Mazdak12-Mar-04 7:18 
GeneralRe: I want to write a application like Microsoft's PowerPoint User interface... Pin
aoyee12-Mar-04 8:40
aoyee12-Mar-04 8:40 
GeneralRe: I want to write a application like Microsoft's PowerPoint User interface... Pin
aoyee13-Mar-04 5:58
aoyee13-Mar-04 5:58 
GeneralDiagnostics Book Pin
Mark Sanders12-Mar-04 5:11
Mark Sanders12-Mar-04 5:11 
GeneralRe: Diagnostics Book Pin
Heath Stewart12-Mar-04 5:18
protectorHeath Stewart12-Mar-04 5:18 
GeneralStrange Behaviour Pin
Matthew Hazlett12-Mar-04 4:42
Matthew Hazlett12-Mar-04 4:42 
GeneralRe: Strange Behaviour Pin
Heath Stewart12-Mar-04 4:53
protectorHeath Stewart12-Mar-04 4:53 
GeneralMarshaling Array of IntPtr Pin
Tristan Rhodes12-Mar-04 3:30
Tristan Rhodes12-Mar-04 3:30 
GeneralRe: Marshaling Array of IntPtr Pin
John Fisher12-Mar-04 3:46
John Fisher12-Mar-04 3:46 
General- COM Interface Function Pin
Tristan Rhodes12-Mar-04 3:51
Tristan Rhodes12-Mar-04 3:51 
GeneralRe: Marshaling Array of IntPtr Pin
Heath Stewart12-Mar-04 4:07
protectorHeath Stewart12-Mar-04 4:07 

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.