Click to See Complete Forum and Search --> : How can I declare an object type from a string?


msweldon
July 2nd, 2004, 11:11 AM
I'm building an automated build and deploy application and one of my problems is that I'm attempting to declare/obtain an object type from a string. I've done it before with Java, but has been quite some time.

I think the syntax for java was/is:

myObject = Class(myObjectString);

Any ideas for c#?

Thanks in advance,
marc

riscoh
July 4th, 2004, 03:03 AM
myObject = Class(myObjectString);


try this .......

myObject = ((Class)myObjectString);

Ravenz
July 4th, 2004, 05:11 PM
This is probably not what you're asking for, but why not! :wave:

string myString = "Hello";
object myObject = (object)myString;