|
-
January 16th, 2012, 03:38 PM
#1
Symbol to a symbol?
So this has always been something that has eluded me, and I know in the sample code below there are certainly much better ways to do this, but I am using this to illustrate my problem. I want to be able to dynamically use a variable, for example...
string item1;
string item2;
string item3;
string item4;
for (int i = 1; i < 4; i++)
item + i = "hello";
This would go through and assign each item# to "hello". Obviously this code does not work, but does anyone know of a way to accomplish something similar? Please don't come back and say use an array or build a class around it because I know you could do that in this situation, but that is not what I am trying to accomplish. I am actually trying to slim down some query code that I am using in entity framework
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|