Click here to Skip to main content
15,902,198 members
Home / Discussions / C#
   

C#

 
QuestionDisplaying Image On A Crystals Report [modified] Pin
sottos28-Oct-07 6:32
sottos28-Oct-07 6:32 
AnswerRe: Displaying Image On A Crystals Report Pin
c0ax_lx29-Oct-07 0:20
c0ax_lx29-Oct-07 0:20 
QuestionDeclaration in C# Pin
devidutta Pradhan28-Oct-07 5:04
devidutta Pradhan28-Oct-07 5:04 
AnswerRe: Declaration in C# Pin
Luc Pattyn28-Oct-07 5:14
sitebuilderLuc Pattyn28-Oct-07 5:14 
GeneralRe: Declaration in C# Pin
deviduttayahoo28-Oct-07 22:02
deviduttayahoo28-Oct-07 22:02 
GeneralRe: Declaration in C# Pin
Urs Enzler28-Oct-07 22:55
Urs Enzler28-Oct-07 22:55 
GeneralRe: Declaration in C# Pin
Luc Pattyn29-Oct-07 1:58
sitebuilderLuc Pattyn29-Oct-07 1:58 
AnswerRe: Declaration in C# Pin
Scott Dorman28-Oct-07 5:25
professionalScott Dorman28-Oct-07 5:25 
devidutta Pradhan wrote:
Can anybody just guide me the difference
between these two declaration in c#

int a;
a=0;


and int a=0;

what is the diffrence is this anyproblem with performance issue??


As Luc pointed out, they are identical ways to do the same thing. There is no performance difference between either of them and both will get compiled to the same code.

However, your other example is different:

devidutta Pradhan wrote:
classA a=new classA();
a=FunctionXXX();


classA a=FunctionXXX();


actually is somewhat ambiguous unless FunxtionXXX() returns a new instance of classA. If that is the case, then again, they are equivalent.

The different syntax exists mainly to support individual preference. Some developers prefer to always declare the variables and then assign them separately while others prefer to do it all in one step. In either case, the compiler doesn't care how it's done and treats these as the same thing.


Scott.

—In just two days, tomorrow will be yesterday.

[Forum Guidelines] [Articles] [Blog]

GeneralRe: Declaration in C# Pin
deviduttayahoo28-Oct-07 22:03
deviduttayahoo28-Oct-07 22:03 
AnswerRe: Declaration in C# Pin
Steve Echols28-Oct-07 5:26
Steve Echols28-Oct-07 5:26 
QuestionNew to C# - Socket, Read/Write problem. Pin
unknown_Sheep28-Oct-07 4:25
unknown_Sheep28-Oct-07 4:25 
Questionmulticolor DataGridView Pin
Assaf8228-Oct-07 3:19
Assaf8228-Oct-07 3:19 
AnswerRe: multicolor DataGridView Pin
Giorgi Dalakishvili28-Oct-07 3:50
mentorGiorgi Dalakishvili28-Oct-07 3:50 
GeneralRe: multicolor DataGridView Pin
Assaf8228-Oct-07 4:09
Assaf8228-Oct-07 4:09 
GeneralRe: multicolor DataGridView Pin
Giorgi Dalakishvili28-Oct-07 4:16
mentorGiorgi Dalakishvili28-Oct-07 4:16 
QuestionNamespace and Dataset! Pin
khalidelmeknesi28-Oct-07 3:10
khalidelmeknesi28-Oct-07 3:10 
AnswerRe: Namespace and Dataset! Pin
Paul Conrad28-Oct-07 6:35
professionalPaul Conrad28-Oct-07 6:35 
GeneralRe: Namespace and Dataset! Pin
khalidelmeknesi28-Oct-07 16:26
khalidelmeknesi28-Oct-07 16:26 
GeneralRe: Namespace and Dataset! Pin
Paul Conrad28-Oct-07 16:53
professionalPaul Conrad28-Oct-07 16:53 
QuestionLicensing in .NET Pin
danielk_28-Oct-07 2:33
danielk_28-Oct-07 2:33 
AnswerRe: Licensing in .NET Pin
Scott Dorman28-Oct-07 3:24
professionalScott Dorman28-Oct-07 3:24 
GeneralRe: Licensing in .NET Pin
jmcc2k24-Nov-10 17:37
jmcc2k24-Nov-10 17:37 
QuestionGraph Pin
babbelfisken28-Oct-07 2:05
babbelfisken28-Oct-07 2:05 
AnswerRe: Graph Pin
Robert Rohde28-Oct-07 2:10
Robert Rohde28-Oct-07 2:10 
QuestionArray as a buffer in multithreading Pin
szolDat28-Oct-07 1:37
szolDat28-Oct-07 1:37 

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.