|
|
 |
RE: FN-FORUM: .NET calling unknown functions from code
date posted 17th January 2005 21:49
Andy,
As far as I know because .net is inherently strongly typed, you can't call
functions in that way. The only way I know of is to use the
System.Reflection namespace to examine a target object and use one of the
Invoke methods to call it's methods dynamically. I've found one article
that may be of use:
http://builder.com.com/5100-6373_14-1050654.html
HTH
Danny
-----Original Message-----
From: [EMAIL REMOVED] [EMAIL REMOVED] On Behalf Of Andy
Macnaughton-Jones
Sent: 17 January 2005 20:16
To: FN-FORUM / [EMAIL REMOVED]
Subject: FN-FORUM: .NET calling unknown functions from code
Hi,
I'm trying to build some code whereby the generates ASP.NET pages will
control the code / functions that are called.
Because the pages are generated by xslt, I don't want to limit the
functions that may or may not be called.
I can't remember how in VB.NET to call a function by a soft-coded name.
E.g.
Dim X as string
X = fnMyFunction("123")
Is fine
But how do I do;
Dim X as string
Dim Y as string
Y = "fnMyFunction"
X = Y("123")
If that makes sense.
Otherwise I'm going to have to hard code all of the functions that I may
or may not call. This is for some shared code and I don't want to have
to limit what I'm doing at this point.
The other option I had was to create an standard interface and create
objects that way, but using createobject("object.class") doesn't work
for me in .NET, so I'm a bit buggered.
Suggestions on a plate please ;-)
Cheers
Andy
and freelance jobs
|
 |
|