dynamic type casting of objects in C#.net
<p>I have created a <code>class student</code> and in that class <code>contact</code> object is created (aggregation). I am retrieving all stored objects in "object" array. </p>

<p>If I want to access <code>student</code> attribute I have to type cast it with <code>student</code> and if I want to access <code>contact</code> attribute either I have to give full path (<code>student_object.contact_object.attribute_name</code>) or simply type cast with <code>contact</code> and get the attribute value.</p>

<p>I have stuck at two places:</p>

<ol>
<li>If I accept class name
from user and then want to access
the value. How can I do that? How to
type cast with textbox variable.</li>
<li>If field name I accept
from user in text box . How can I
access the value using text box
variable?</li>
</ol>

<p>Jon,
   Actually I have created a object oriented database in C#.NET. where above classes are there. I am Retrieving all objects in Object array. Class student has field name and age , while contact has mobileID . Now I am creating a query through textboxes. If user want to see name of all the object , then var2 name he shold put. but i am not able to get this message
 messageBox.show(o0 as Student).var2);
Same if instead of Student if I give var1
messageBox.show(o0 as var1).var2);
Can I do this? 
thanks/Bharti</p>
