string to object

J

John Cotsell

Basically I have a class called Dog and when using the objectdatasource I
can use a string parameter to pass into the selectmethod. so I pass in a
string = 'Dog' now once in the selectmethod I need to convert that string
into and object of type Dog...I hope this makes sense. Do anyone know how to
do this???? i guess I need a similar method to Eval in javascript.

Please need urgent so could replies also go to (e-mail address removed)

cheers John
 
G

Guest

Basically I have a class called Dog and when using the
objectdatasource I can use a string parameter to pass into the
selectmethod. so I pass in a string = 'Dog' now once in the
selectmethod I need to convert that string into and object of type
Dog...I hope this makes sense. Do anyone know how to do this????


System.Type.GetType can return objects based on Type.
Please need urgent so could replies also go to (e-mail address removed)

If you post on Usenet, check on Usenet.
 
K

KJ

For equivalent to javascript's eval, check out the namespaces
System.Reflection.Emit (for creating assemblies on-the-fly) or perhaps
Microsoft.CSharp.Compiler (try the static Compile() method)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top