New Message on dotNET User Group Hyd

instantiating an object in a LOOP

Reply
  Reply to Sender   Recommend Message 2 in Discussion
From: kish728

hi raj,

See the following details and one time a loop.

for each loop the following steps occur :
step1 : Object is Created in Heap and reference pointer sent back to
object variable (i.e Allocation of memory to object).
step2 : usage of the created object & your executable statemets to be
executed.
step3 : when you reach End of the Loop, Object types or Value types
created with in the loop is to be destroyed.

the above steps are repeated for each loop. You can't find performance
problems for smaller loops but you substantially identify the performance
difference between Object is declared out of the loop and with in the loop.

Alternative solution for above problem :
Step1 : Declared required object.
step2 : Enter in to the loop
call for object initialization method (instead of creating
object)
step3 : do your operations.
step4 : after coming out of the loop call Object's Dispose method.

that's all

if you have more doubts, welcome to discuss...
Thanks & regards,

Kishore
Sr Softwar Engineer.


>From: "dotNET User Group Hyd" <[EMAIL PROTECTED]>
>Reply-To: "dotNET User Group Hyd" <[EMAIL PROTECTED]>
>To: "dotNET User Group Hyd" <[EMAIL PROTECTED]>
>Subject: instantiating an object in a LOOP
>Date: Fri, 10 Dec 2004 03:02:01 -0800
>

_________________________________________________________________
Hey there NRIs! Desi news, films, �n more! http://www.msn.co.in/nri/ Stay in
the loop!

View other groups in this category.

Click here
Also on MSN:
Start Chatting | Listen to Music | House & Home | Try Online Dating | Daily Horoscopes

To stop getting this e-mail, or change how often it arrives, go to your E-mail Settings.

Need help? If you've forgotten your password, please go to Passport Member Services.
For other questions or feedback, go to our Contact Us page.

If you do not want to receive future e-mail from this MSN group, or if you received this message by mistake, please click the "Remove" link below. On the pre-addressed e-mail message that opens, simply click "Send". Your e-mail address will be deleted from this group's mailing list.
Remove my e-mail address from dotNET User Group Hyd.

Reply via email to