Using Object IDs in C#’s Debugger to chase object references

I’ve needed this a few times in the past and figured I best note it down for my own reference.

If you have created a number of objects and you want to be able to compare them during debugging, you can assign an Object ID to each instance of the object in the watch window like this:
Assign Object ID to object instance

Once assigned, you can evaluate that particular object instance either in the watch window or in the expression evaluator:
Evaluating an object using its ID

(The above images have been pilfered from Jim Griesmer)

1 comment

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>