Click here to Skip to main content
15,893,594 members
Home / Discussions / C#
   

C#

 
GeneralRe: developing Client / Server application C#: Create code Client 2 ? Pin
hajajj 27-Aug-13 12:57
hajajj 27-Aug-13 12:57 
GeneralRe: developing Client / Server application C#: Create code Client 2 ? Pin
Pete O'Hanlon7-Aug-13 13:49
mvePete O'Hanlon7-Aug-13 13:49 
GeneralRe: developing Client / Server application C#: Create code Client 2 ? Pin
hajajj 28-Aug-13 0:45
hajajj 28-Aug-13 0:45 
GeneralRe: developing Client / Server application C#: Create code Client 2 ? Pin
Pete O'Hanlon8-Aug-13 0:54
mvePete O'Hanlon8-Aug-13 0:54 
GeneralRe: developing Client / Server application C#: Create code Client 2 ? Pin
Simon_Whale8-Aug-13 1:42
Simon_Whale8-Aug-13 1:42 
GeneralRe: developing Client / Server application C#: Create code Client 2 ? Pin
hajajj 28-Aug-13 1:49
hajajj 28-Aug-13 1:49 
QuestionRe: developing Client / Server application C#: Create code Client 2 ? Pin
Eddy Vluggen8-Aug-13 9:12
professionalEddy Vluggen8-Aug-13 9:12 
GeneralRe: developing Client / Server application C#: Create code Client 2 ? Pin
Jean A Brandelero8-Aug-13 10:41
Jean A Brandelero8-Aug-13 10:41 
QuestionHow to Pop mails From Mail to biztalk then save it in database Pin
Ahmed Abdelnasser7-Aug-13 2:17
Ahmed Abdelnasser7-Aug-13 2:17 
AnswerRe: How to Pop mails From Mail to biztalk then save it in database Pin
Simon_Whale7-Aug-13 3:29
Simon_Whale7-Aug-13 3:29 
QuestionWant to create a websocket server in c# Pin
Member 101935636-Aug-13 18:50
Member 101935636-Aug-13 18:50 
AnswerRe: Want to create a websocket server in c# Pin
Abhinav S6-Aug-13 19:47
Abhinav S6-Aug-13 19:47 
QuestionConcatenating 2 columns into one (radgrid) Pin
Member 101936536-Aug-13 9:59
Member 101936536-Aug-13 9:59 
AnswerRe: Concatenating 2 columns into one (radgrid) Pin
Mycroft Holmes6-Aug-13 13:00
professionalMycroft Holmes6-Aug-13 13:00 
QuestionObjects created in a loop - definition name Pin
DSLoginYea6-Aug-13 2:02
DSLoginYea6-Aug-13 2:02 
AnswerRe: Objects created in a loop - definition name Pin
Dave Kreskowiak6-Aug-13 2:47
mveDave Kreskowiak6-Aug-13 2:47 
AnswerRe: Objects created in a loop - definition name Pin
Clifford Nelson6-Aug-13 8:36
Clifford Nelson6-Aug-13 8:36 
GeneralRe: Objects created in a loop - definition name Pin
DSLoginYea6-Aug-13 9:28
DSLoginYea6-Aug-13 9:28 
GeneralRe: Objects created in a loop - definition name Pin
nick.j.s6-Aug-13 10:51
nick.j.s6-Aug-13 10:51 
GeneralRe: Objects created in a loop - definition name Pin
DSLoginYea6-Aug-13 10:55
DSLoginYea6-Aug-13 10:55 
GeneralRe: Objects created in a loop - definition name Pin
Dave Kreskowiak6-Aug-13 10:59
mveDave Kreskowiak6-Aug-13 10:59 
GeneralRe: Objects created in a loop - definition name Pin
Dave Kreskowiak6-Aug-13 10:59
mveDave Kreskowiak6-Aug-13 10:59 
No, there really isn't a name for it because, in your loop, you only ever have one object instance!

You're not creating "multiple objects with the same identifier". Only one instance of that class is ever alive. On the next iteration of the loop, the object created in the last iteration is already gone.


DSLoginYea wrote:
Code:
 
TestA a = new TestA();
TestA a = new TestA();

 
Result: "A local variable named a is already defined in this
scope"
 

However, that is allowed in a loop


No, the loop does not get around that limitation. It's still there. You're not understanding what's going on inside the loop!


DSLoginYea wrote:
I have modified my code below - the 10 objects of type TestA are all named "a".
They will still remain in scope (and not ready garbage collection) after the
loop that created them has finished.
 

ArrayList anArrayList =
new ArrayList();
 

for (int i = 0; i < 10;
i++)
{
TestA a = new TestA();

anArrayList.Add(a);
}

Now you've changed the entire circumstances surrounding the creation of the objects. Now, since you have an array (outside the loop!) holding onto the references of those objects you created inside the loop, the objects are still be references by outside code and do not fall out of scope until the array falls out of scope.

Still, there is no name for this. You're just creating an array, or collection, and filling it with objects created by a loop.

AnswerRe: Objects created in a loop - definition name Pin
Jean A Brandelero8-Aug-13 10:43
Jean A Brandelero8-Aug-13 10:43 
QuestionWah Wah effect for guitar Pin
paulera6-Aug-13 1:52
paulera6-Aug-13 1:52 
AnswerRe: Wah Wah effect for guitar Pin
Ravi Bhavnani6-Aug-13 6:02
professionalRavi Bhavnani6-Aug-13 6:02 

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.