| | |
Refer to an instance using a variable
Please support our C# advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Dec 2006
Posts: 8
Reputation:
Solved Threads: 0
In C# I need to know if it's possible to use a variable (string) as object name.
For example
or in a loop do that ...
....
.....
Thanks.
For example
C# Syntax (Toggle Plain Text)
string myInstanceName = "myObject"; [myInstanceName].callMethod(bla, bla, bla); [myInstanceName].property = "bla bla 2";
or in a loop do that ...
....
C# Syntax (Toggle Plain Text)
[myInstanceName+i.ToString()].callMethod(bla, bla, bla);
Thanks.
![]() |
Similar Threads
- runtime error 91 object variable or With block variable not set (Visual Basic 4 / 5 / 6)
- Problems from string to int array (C)
- Class question (PHP)
- How can I create an explicit instance of a class? (VB.NET)
- Open Gl Programing Error (help)... (Game Development)
- Need to implemnt the RTF print in application (VB.NET)
- Global v/s Public (Visual Basic 4 / 5 / 6)
- Very New to java, skeleton of program given (Java)
- problems with referring to class variables (Java)
Other Threads in the C# Forum
- Previous Thread: Parallel threading problem
- Next Thread: Reflection Invoke Method w/ Params
| Thread Tools | Search this Thread |
.net access ado.net algorithm array barchart bitmap box broadcast buttons c# chat check checkbox client color combobox control conversion cryptographyc#winformsencryption csharp custom database datagrid datagridview dataset datetime degrees development draganddrop drawing encryption enum event excel file files form format forms function gdi+ httpwebrequest image index input install java keypress label list listbox listener mandelbrot math mouseclick mysql networking operator path photoshop picturebox pixelinversion post prime programming radians regex remote remoting richtextbox save saving serialization server sleep socket sql statistics stream string table tcp text textbox thread time timer treeview update usercontrol validate validation view visualstudio webbrowser windows winforms wpf xml





