• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 608
  • Last Modified:

infinite loop within a foreach?

Hi,

I have a foreach, inside of a try/catch, within a property.  And somehow the foreach is looping infinitely.  Is there anything amiss so far that could cause this.  Any ideas?

Thanks,
Bob
0
ba272
Asked:
ba272
1 Solution
 
Mike TomlinsonMiddle School Assistant TeacherCommented:
Could we possibly see the code?....
0
 
Fernando SotoRetiredCommented:
That will be difficult without seeing your code.
0
 
athapaCEO / CTOCommented:
My guess is that you are probably trying to set the value of the property using the property name again instead of using some private variable.
For example

public string SomeString
{
    set
    {
        this.SomeString = value;
    }
}

AT
0
 
ba272Author Commented:
that's right!  I was using a property name, instead of a variable name.  Different only by case.  Good call.

Thanks,
Bob
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now