Click here to Skip to main content
15,914,905 members
Home / Discussions / C#
   

C#

 
GeneralRe: DataGrid to DataSet to XML Pin
OmegaSupreme13-Mar-04 2:30
OmegaSupreme13-Mar-04 2:30 
GeneralRe: DataGrid to DataSet to XML Pin
jazzle13-Mar-04 3:30
jazzle13-Mar-04 3:30 
GeneralRe: DataGrid to DataSet to XML Pin
Mike Ellison15-Mar-04 8:29
Mike Ellison15-Mar-04 8:29 
Generalhelp!!! Very strange problem with sending mail Pin
wolft12-Mar-04 15:17
wolft12-Mar-04 15:17 
GeneralRe: help!!! Very strange problem with sending mail Pin
John Fisher13-Mar-04 13:30
John Fisher13-Mar-04 13:30 
GeneralINT to Binary Pin
MrEyes12-Mar-04 14:14
MrEyes12-Mar-04 14:14 
GeneralRe: INT to Binary Pin
PJL12-Mar-04 15:04
PJL12-Mar-04 15:04 
GeneralRe: INT to Binary Pin
Michael Flanakin17-Mar-04 19:36
Michael Flanakin17-Mar-04 19:36 
GeneralSomething wrong with my binding to datagird. Pin
lordjpg12-Mar-04 13:08
lordjpg12-Mar-04 13:08 
GeneralRe: Something wrong with my binding to datagird. Pin
MrEyes12-Mar-04 14:30
MrEyes12-Mar-04 14:30 
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 

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.