473,385 Members | 1,429 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Generate TYPE on-the-fly

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
4 2275
-----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
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
>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
-----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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Mohit Gupta | last post by:
How do I generate Big Integers in VB .NET? For example, if I have a number like 98908324328432864872364234623874682342234234242342 that can't be stored in INT64 or INT32 type variable. How...
3
by: Tanguy Fautré | last post by:
Hi, given a class class foo { private: void A(); type B(); };
3
by: Bert | last post by:
Hi, I would like to generate an xml schema based upon a class, just as you can do with xsd.exe (xsd.exe /type: typename /outputdir:c:\ assmeblyname). Is there a way to do this by code instead...
2
by: Schnogge | last post by:
Hi! it is possible to generate an multiple-dimensional array with different data types? Or is it possible to combine a one-dimensional array with an other which has an other data type? How...
3
by: Nick | last post by:
In case anyone in is need... <html> <head> <script language="javascript"> function getStates () { stateCodes = new Array('AK','AL','AR','CA','CO','CT','DC','ETC'); for (var...
5
by: Chameleon | last post by:
I totally messed up with this: We have -------------------------------------- generate(v.begin(), v.end(), my_func); -------------------------------------- and my_func: ----------- int...
1
by: xer | last post by:
I want to generate ssl certificate (with public key) and private key. My code: $ssl_configargs = array( "digest_alg" => "sha1", "private_key_bits" => 2048, "private_key_type" =>...
0
by: Patrick.O.Ige | last post by:
Hi guys, How to generate this xsd schema below for SqlXml <?xml version="1.0" ?> <Schema xmlns="urn:schemas-microsoft-com:xml-data" xmlns:dt="urn:schemas-microsoft-com:datatypes"...
111
by: Nate | last post by:
Hello, I am looking for a method to automatically declare variables in C. I'm not sure if there is a good way to do this, but I had something like this in mind... int i; for(i = 1; i < 4;...
2
by: ganesh22 | last post by:
Hi, My requirement is i want to auto generate ID'S in sqlserver that means in database one column is there recordid for that coloumn i want to add numbers with no duplication like JDS 10001,JDS...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.