I would use reflection to see if there were any accessible constructors
of foo.bar that took a single integral parameter...benefits being that
this would work for non-COM .net objects as well.

Justin E. Pitts
Technical Consultant
Data and Application Integration Services
Big Lots - World's Best Bargain Place!


-----Original Message-----
From: Moderated discussion of advanced .NET topics.
[mailto:[EMAIL PROTECTED] On Behalf Of
[EMAIL PROTECTED]
Sent: Monday, June 16, 2003 6:03 PM
To: [EMAIL PROTECTED]
Subject: [ADVANCED-DOTNET] Constructing Objects From Strings in dotnet

The COM platform provided the moniker mechanism to create objects in a
certain fashion and initialize those objects a certain way.  This was
quite convenient when representing the object specification as a string.

If I want a user to be able to configure a .net object construction, how
would I go about this.

For example the string "object:foo.bar!r=6" is equivelent to the C#
code:

int r=6;
new foo.bar(r);

and I would like to create or get a reference to the object by calling
something analagous to 
GetObject("object:foo.bar!r=6");


Creating the class dynamically doesn't seem to be a problem with the
Activator methods, but what can be used to turn the intializer string
into constructor arguments?



Doug Ransom
Software Interoperability Architect
Power Measurement
2195 Keating X Road
Saanichton, BC, Canada  V8M 2A5
Tel: 1-(250) 652-7100  
E-Mail: <mailto:[EMAIL PROTECTED]>
Website: <http://www.pwrm.com/>

ION(r)  smart energy everywhere(tm)

Reply via email to