# Access object programmatically in c#

**URL:** <https://forum.kirupa.com/t/access-object-programmatically-in-c/238705>\
**Category:** programming\
**Created:** [September 14, 2007, 2:07am UTC](https://forum.kirupa.com/t/access-object-programmatically-in-c/238705 "2007-09-14T02:07:42Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![flashinapan](https://avatars.discourse-cdn.com/v4/letter/f/49beb7/32.png) [@flashinapan](https://forum.kirupa.com/u/flashinapan)\
**Post date:** [September 14, 2007, 2:07am UTC](https://forum.kirupa.com/t/access-object-programmatically-in-c/238705/1 "2007-09-14T02:07:42Z")

</div>

Let’s say I’ve got two objects that are named Thing1 and Thing2. I would like to, in C# code, be able to loop through these objects and apply the same logic to each. Obviously, the loop logic would have to construct the name on the fly (like “Thing” + x, where x = 1 during the first iteration, x = 2 during the second iteration, etc.). But I haven’t found a way to get this to work.
