Generate TYPE on-the-fly

  • Thread starter Thread starter Zoltan Hernyak
  • Start date Start date
Z

Zoltan Hernyak

Hi,

Can I generate a new type (a class with fields only) on-the-fly, from
a running app, and use it right then? For example if I want to build
a class which consists of fields which are parameters of a method.

I want to write a method which gives a method 'name' as a parameter,
and construct a class which has the same fields as the method has
using reflection or something like that... and use the new class
immediately in the same app. (crazy?!)

Is it possible?

Zoltan
 
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Zoltan,

My question would be "what are you trying to achieve with that?" I mean,
maybe there is a simpler way of achieving what you want without
resorting to that.

If you really really really have to do that, however, may I suggest...
Python? :)

Zoltan Hernyak wrote:

| Hi,
|
| Can I generate a new type (a class with fields only) on-the-fly, from
| a running app, and use it right then? For example if I want to build
| a class which consists of fields which are parameters of a method.
|
| I want to write a method which gives a method 'name' as a parameter,
| and construct a class which has the same fields as the method has
| using reflection or something like that... and use the new class
| immediately in the same app. (crazy?!)
|
| Is it possible?
|
| Zoltan
|

- --
Ray Hsieh (Ray Djajadinata) [SCJP, SCWCD]
ray underscore usenet at yahoo dot com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (MingW32)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQE/oT4BwEwccQ4rWPgRArGKAJ49iYIT4CGpy30C1W6BjczIsW0rVQCeLMJz
ykAsa0dw1hHM/DR1n6xKfSI=
=5JU5
-----END PGP SIGNATURE-----
 
TypeBuilder. See:
ms-help://MS.VSCC.2003/MS.MSDNQTR.2003JUL.1033/cpref/html/frlrfsystemreflect
ionemittypebuildermemberstopic.htm
 
My question would be "what are you trying to achieve with that?" I mean,
maybe there is a simpler way of achieving what you want without
resorting to that.
using WSE 2, a GetBodyObject( ) method can be used to get all the data
included into the SOAP body. This method receives only ONE type, and
generates one instance from that type, fill all the data, then return
with it. If I see this message is for a method called "Something",
which needs an int and a string, the easiest way :-))) to generate a
class on-the-fly consist of an int and a string, then call the
GetBodyObject. When I have the desired (and de-serialized) data,
I can take care of them, and call the method using some reflection,
and some brain...

May be there a run-time code generating stuff in the .NET ?
If you really really really have to do that, however, may I suggest...
Python? :)

Of course not :-))) I have to use WSE 2.0 :-)

Zoltan
 
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Well, William has the answer for you in his reply below :) (but I love
Python!) :))

Zoltan Hernyak wrote:

| Of course not :-))) I have to use WSE 2.0 :-)
|
| Zoltan


- --
Ray Hsieh (Ray Djajadinata) [SCJP, SCWCD]
ray underscore usenet at yahoo dot com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (MingW32)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQE/ojYkwEwccQ4rWPgRArVwAJ0Q0pQAM/A5oteZXG73yZOirQraygCfbIp/
x+L3aQ1HW7gjZP/A4QRupME=
=ZGVO
-----END PGP SIGNATURE-----
 
Back
Top