Saturday, March 31, 2012

string to object

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 johncotsell@dotnet.itags.org.hotmail.com
cheers John"John Cotsell" <john.cotsell@.formicary.net> wrote in
news:epLI7fRHGHA.1192@.TK2MSFTNGP11.phx.gbl:

> 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 johncotsell@.hotmail.com
If you post on Usenet, check on Usenet.
Stan Kee (spamhoneypot@.rogers.com)
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)

0 comments:

Post a Comment