Click here to Skip to main content
15,880,364 members
Home / Discussions / C#
   

C#

 
GeneralRe: RadGrid, DataTable And Caption Problem Pin
KlimUser29-Apr-08 10:47
KlimUser29-Apr-08 10:47 
GeneralSomething basic Pin
Spykraft29-Apr-08 7:13
Spykraft29-Apr-08 7:13 
GeneralRe: Something basic Pin
PIEBALDconsult29-Apr-08 7:24
mvePIEBALDconsult29-Apr-08 7:24 
GeneralRe: Something basic Pin
carbon_golem29-Apr-08 7:28
carbon_golem29-Apr-08 7:28 
GeneralRe: Something basic Pin
PIEBALDconsult29-Apr-08 12:11
mvePIEBALDconsult29-Apr-08 12:11 
GeneralRe: Something basic Pin
Spykraft29-Apr-08 7:38
Spykraft29-Apr-08 7:38 
GeneralRe: Something basic Pin
carbon_golem29-Apr-08 8:06
carbon_golem29-Apr-08 8:06 
GeneralRe: Something basic Pin
Spykraft29-Apr-08 12:11
Spykraft29-Apr-08 12:11 
Thanks a lot Scott,

carbon_golem wrote:
Have you timed it yourself?


Nope I havent timed it yet, how do i do that?

I did look at the ildasm. Thanks a lot, it cleared a big stumble in the thought process.

Okay agreed that with a method call, there is an additional overhead for puting the instruction on the stack and the return.

However compare it to the scenario where the class A and class B objects are being created more than once in Class C, would it be more economical to invoke the constructors everytime and initialize the members, even if we dont need them to be initialized; or just call a method once and pass the object references to initialize them once?

The IL clearly showed how a simple initialization like string.Empty is costly to refer to the Empty member of the system.string. Why do it twice? why not do it just once in a method call and avoid the redundancy?

Agreed there is a cost to make the call to the constructor and the method, but what about the cost of redundancy by calling the class ctor but not using that object any further.
Pass the object to a method that initializes/constructs it when it is needed.

What say?

------------------------------------
Vision is the ability to see the invisible

GeneralRe: Something basic Pin
carbon_golem29-Apr-08 16:59
carbon_golem29-Apr-08 16:59 
GeneralRe: Something basic Pin
PIEBALDconsult29-Apr-08 9:31
mvePIEBALDconsult29-Apr-08 9:31 
GeneralDatagridview and keyenter Pin
Canann29-Apr-08 4:43
Canann29-Apr-08 4:43 
QuestionRe: Datagridview and keyenter Pin
Canann30-Apr-08 2:51
Canann30-Apr-08 2:51 
QuestionHow to generate Typed DataSet with CodeDom ? Pin
hdv21229-Apr-08 3:03
hdv21229-Apr-08 3:03 
Generalanti-pattern in GC Pin
George_George29-Apr-08 2:59
George_George29-Apr-08 2:59 
GeneralRe: anti-pattern in GC Pin
Colin Angus Mackay29-Apr-08 4:03
Colin Angus Mackay29-Apr-08 4:03 
GeneralRe: anti-pattern in GC Pin
George_George29-Apr-08 4:26
George_George29-Apr-08 4:26 
GeneralRe: anti-pattern in GC Pin
led mike29-Apr-08 4:53
led mike29-Apr-08 4:53 
GeneralRe: anti-pattern in GC Pin
George_George29-Apr-08 4:59
George_George29-Apr-08 4:59 
GeneralRe: anti-pattern in GC Pin
led mike29-Apr-08 5:40
led mike29-Apr-08 5:40 
GeneralRe: anti-pattern in GC Pin
George_George29-Apr-08 20:41
George_George29-Apr-08 20:41 
GeneralRe: anti-pattern in GC Pin
led mike30-Apr-08 4:50
led mike30-Apr-08 4:50 
GeneralRe: anti-pattern in GC Pin
George_George30-Apr-08 22:06
George_George30-Apr-08 22:06 
GeneralRe: anti-pattern in GC Pin
led mike1-May-08 6:18
led mike1-May-08 6:18 
GeneralRe: anti-pattern in GC Pin
George_George1-May-08 21:47
George_George1-May-08 21:47 
Generalinserting string into string Pin
stephan_00729-Apr-08 2:59
stephan_00729-Apr-08 2:59 

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.