Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I have made a List containing all the original data (.shp files), and I have another List containing the modified data. I basically want to check all the modified file data against the original... So here lies the problem, I next a loop within a loop to check if the original exists within the modified List... and it always seems to find a match? Is my approach right?

This is the sample code I have for PointZ type shapes

 foreach (PointZ origrecord in origPointZList)
        {
            Boolean foundIt = false;

            foreach (PointZ modrecord in origPointZList)
            {
                if ((origrecord.X == modrecord.X)
                    && (origrecord.Y == modrecord.Y)
                    && (origrecord.Z == modrecord.Z)
                    && (origrecord.M == modrecord.M))
                {
                    foundIt = true;
                    break;

                }
                else
                {
                    foundIt = false;
                }

            }
            if (!foundIt)
            {
                result += "Record not found";
            }
share|improve this question

closed as too localized by whuber May 24 '13 at 13:47

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

1 Answer 1

up vote 1 down vote accepted

Both your foreach loops iterate the same list!

share|improve this answer
    
I think I changed it to that for testing... if not... wow, can't believe I wouldn't have noticed that. –  Evan Parsons May 24 '13 at 13:44
    
Actually that was it... I think I need more coffee, thank you! –  Evan Parsons May 24 '13 at 13:45

Not the answer you're looking for? Browse other questions tagged or ask your own question.