string to object

  • Thread starter Thread starter John Cotsell
  • Start date Start date
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
 
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.
 
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)
 
Back
Top