I need to create 150 variable names....need an efficient way of doing it
-
I need to create 150 variable names. They must be like "varName01" , "varName01" all the way to 150. How do I do this using a for or while loop? thanks! Sundeep
There is never a technical need for this sort of thing. Consider using a Hash Table or an Array or a Stack or a Queue or another more appropriate data structure.
Need custom software developed? I do custom programming based primarily on MS tools with an emphasis on C# development and consulting. A man said to the universe: "Sir I exist!" "However," replied the universe, "The fact has not created in me A sense of obligation." --Stephen Crane
-
I need to create 150 variable names. They must be like "varName01" , "varName01" all the way to 150. How do I do this using a for or while loop? thanks! Sundeep
-
I need to create 150 variable names. They must be like "varName01" , "varName01" all the way to 150. How do I do this using a for or while loop? thanks! Sundeep
-
What if its an array of objects? class[] object = new class();?
-
What if its an array of objects? class[] object = new class();?
-
heh, cool..so now i'm stuck at how to return all the elements of an array at the end of a method I cant do
for(int i = 0; i < 20; i++)
{
return arrayOfObjects[i];
}I will have unreachable code.
-
heh, cool..so now i'm stuck at how to return all the elements of an array at the end of a method I cant do
for(int i = 0; i < 20; i++)
{
return arrayOfObjects[i];
}I will have unreachable code.
-
I am trying to return an array...but I cant do return objectArray; the compiler error: Error 1 Cannot implicitly convert type 'Interactive.Geo.WellLog.Track.cgStackedTrack[]' to 'Interactive.Geo.WellLog.Track.cgStackedTrack' C:\Program Files\INT\Net\3.0.3693.0\Tutorials\WellLog.NET\StackedTrackTutorial\StackedTrackTutorial.cs 177 20 StackedTrackTutorial
-
I am trying to return an array...but I cant do return objectArray; the compiler error: Error 1 Cannot implicitly convert type 'Interactive.Geo.WellLog.Track.cgStackedTrack[]' to 'Interactive.Geo.WellLog.Track.cgStackedTrack' C:\Program Files\INT\Net\3.0.3693.0\Tutorials\WellLog.NET\StackedTrackTutorial\StackedTrackTutorial.cs 177 20 StackedTrackTutorial
-
I am trying to return an array...but I cant do return objectArray; the compiler error: Error 1 Cannot implicitly convert type 'Interactive.Geo.WellLog.Track.cgStackedTrack[]' to 'Interactive.Geo.WellLog.Track.cgStackedTrack' C:\Program Files\INT\Net\3.0.3693.0\Tutorials\WellLog.NET\StackedTrackTutorial\StackedTrackTutorial.cs 177 20 StackedTrackTutorial
-
Hey thanks! I think I fixed it. Sorry for the stupid question...
-
heh, cool..so now i'm stuck at how to return all the elements of an array at the end of a method I cant do
for(int i = 0; i < 20; i++)
{
return arrayOfObjects[i];
}I will have unreachable code.
Soooooo how did you think you were going to return the values of 150 different variables??
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007, 2008
But no longer in 2009... -
I need to create 150 variable names. They must be like "varName01" , "varName01" all the way to 150. How do I do this using a for or while loop? thanks! Sundeep
-
Do you really have a valid need to do this?
Online only for only an hour a day. Please expect delay in response.
Well...yes..but I at the end I figured out that I did not need to create 150 variable names. An array worked fine. Sorry for the newbie question, I am a newbie and basically I've learned not to be afraid of asking "newbie" or stupid questions. That's the way I learn.... once again I apologize f :) r my idiocy.