SEANT 发表于 2022-7-6 07:13:49

I agree.It is absolutely necessary for referencing outside of the “For” loop.My statement addresses something more subtle –the reason I used the wording that I did.
 
 
 
A line:
 
Dim ThisVariable AsThatObject
 
Instructs the OS to set aside a certain chunk of memory to contain the object.There is no reason to keep making that assessment/setting within the loop.Even if the actual Object or Structure will not be needed from on loop to the next, the same memory address (size and location) can be re-used and avoid repeated Garbage Collections.

BlackBox 发表于 2022-7-6 07:18:30

 
Well said, and something that I should have picked up on initially... Something which seems so obvious after reading your clarification.
 
Cheers

SEANT 发表于 2022-7-6 07:23:48

The loop would have to be very prolific for these subtleties to make a noticeable difference.I think it is a good habit to employ none the less.

BlackBox 发表于 2022-7-6 07:31:32

 
I'm all for this.
页: 1 [2]
查看完整版本: VB.net: Perpendicular lines to