Refer to an instance using a variable

Please support our C# advertiser: Intel Parallel Studio Home
Reply

Join Date: Dec 2006
Posts: 8
Reputation: floydus is an unknown quantity at this point 
Solved Threads: 0
floydus floydus is offline Offline
Newbie Poster

Refer to an instance using a variable

 
0
  #1
Jun 20th, 2008
In C# I need to know if it's possible to use a variable (string) as object name.
For example

  1. string myInstanceName = "myObject";
  2. [myInstanceName].callMethod(bla, bla, bla);
  3. [myInstanceName].property = "bla bla 2";

or in a loop do that ...
....
  1. [myInstanceName+i.ToString()].callMethod(bla, bla, bla);
.....

Thanks.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC