By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,857 Members | 1,793 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,857 IT Pros & Developers. It's quick & easy.

Generate TYPE on-the-fly

P: n/a
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

Nov 15 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
-----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/oT4BwEwccQ4rWPgRArGKAJ49iYIT4CGpy30C1W6BjczIsW0rVQ CeLMJz
ykAsa0dw1hHM/DR1n6xKfSI=
=5JU5
-----END PGP SIGNATURE-----

Nov 15 '05 #2

P: n/a
TypeBuilder. See:
ms-help://MS.VSCC.2003/MS.MSDNQTR.2003JUL.1033/cpref/html/frlrfsystemreflect
ionemittypebuildermemberstopic.htm

--
William Stacey, MVP

"Zoltan Hernyak" <ar***@ektf.hu> wrote in message
news:ti********************************@4ax.com...
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

Nov 15 '05 #3

P: n/a
>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
Nov 15 '05 #4

P: n/a
-----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-----

Nov 15 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.