• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 605
  • 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 SotoCommented:
That will be difficult without seeing your code.
0
 
athapaCommented:
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

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

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