473,659 Members | 2,685 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

create a class dynamicaly at run-time?

How to create a class dynamicaly at run-time?
Some documentations in MSDN say that it is feasible
using the class "TypeBuilder",b ut I don't know how to do.
Is there anyone who can help me? Sample code is
appreciated.

Jul 21 '05 #1
3 1719
Hi peter,

Do you want to create a new instance from a class or create a new class and
an instance from it?
If you are interested in the first option then take a look at Activator
Class (Activator.Crea teInstance).
If you are interested in the other you might consider using CodeDom.

--
Miha Markic - RightHand .NET consulting & software development
miha at rthand com
www.rthand.com

"peter" <an*******@disc ussions.microso ft.com> wrote in message
news:01******** *************** *****@phx.gbl.. .
How to create a class dynamicaly at run-time?
Some documentations in MSDN say that it is feasible
using the class "TypeBuilder",b ut I don't know how to do.
Is there anyone who can help me? Sample code is
appreciated.

Jul 21 '05 #2
peter <an*******@disc ussions.microso ft.com> wrote:
How to create a class dynamicaly at run-time?
Some documentations in MSDN say that it is feasible
using the class "TypeBuilder",b ut I don't know how to do.


Look in the MSDN for TypeBuilder - you'll find there's an example
there.

--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Jul 21 '05 #3
Hi
chek this URL out
http://www.west-wind.com/presentatio...ynamicCode.htm
you'll find good documentation on this one along with a complete working
sample. I used it in my programs no complains yet

Prasanna

"Jon Skeet [C# MVP]" <sk***@pobox.co m> wrote in message
news:MP******** *************** *@msnews.micros oft.com...
peter <an*******@disc ussions.microso ft.com> wrote:
How to create a class dynamicaly at run-time?
Some documentations in MSDN say that it is feasible
using the class "TypeBuilder",b ut I don't know how to do.


Look in the MSDN for TypeBuilder - you'll find there's an example
there.

--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too

Jul 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
10335
by: Jeff Thies | last post by:
I have a number of elements of "some-class". I'd like to change the styles of some-class: from ..some-class{color: red; display: block} to
2
11816
by: Paul | last post by:
I am trying to get a form to dynamicaly add hidden elements. Below is the function I've created, basicaly it loops thru an array and attempts to add those values to a newly created hidden input field which it then appends to the form. I works in IE, but in NN7 nothing is passed. function processAssortment(){ // get the form Element var formElement=document.getElementById("candyBoxForm"); //loop thru the candy box contents, add them to...
1
323
by: Daniel | last post by:
How do i dynamicaly load and unload a C# dll at runtime
3
1685
by: minigitoo | last post by:
Hi I try to get dynamicaly all requests made to DB2 I process like this: 1) I stop then start my instance of database in the db2 control center 2) I use : db2 update monitor switches using statement on 3) then: db2 get snapshot for dynamic sql on <MyDatabase> I manage to get logs between instant t1 and t2, but i would like to see dynamicaly request which come to db2. I mean i would like to see in a
1
2552
by: Roman Muntyanu | last post by:
Hi all, I created resource dll dynamicaly using this code AppDomain curDom = AppDomain.CurrentDomain; AssemblyName myAssemblyName = new AssemblyName(); imagesAssemblyName.Name = "Images"; AssemblyBuilder myAssemblyBuilder = curDom.DefineDynamicAssembly(myAssemblyName, AssemblyBuilderAccess.Save);
2
2177
by: Daniel | last post by:
how to create a gif or png dynamicaly in .aspx and return in response?
2
1327
by: Marc Nederhoff | last post by:
Hi all, Is it possible to add the <link rel="stylesheet"....> dynamicaly. All pages in my site use the same style sheet, and I don't want to add the link manualy because of maintenance. Marc
7
7764
by: moondaddy | last post by:
I want to dynamically create a JavaScript file and cache it on the client for re-use. I know how to write javascript to a web page from the code behind, but I don't know how to actually create a file such as MyNewScript.js and then cache that on the client so all the pages of that session can use it. Can this be done? Thanks -- moondaddy@nospam.com
12
3784
by: Michael Maes | last post by:
Hello, I have a BaseClass and many Classes which all inherit (directly) from the BaseClass. One of the functions in the BaseClass is to (de)serialize the (inherited) Class to/from disk. 1. The Deserialization goes like: #Region " Load "
0
905
by: bala | last post by:
hi can anyone tell me how to create crystal report dynamicaly(runtime)
0
8427
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8330
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8850
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8523
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8626
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7355
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5649
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4175
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
1975
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.