PC Review


Reply
Thread Tools Rate Thread

Create Class at Runtime?

 
 
xenophon
Guest
Posts: n/a
 
      4th Aug 2005


I have a DataTable with 3 columns in it - Name, Type, Value.
I have these rows in the DataTable -
myProp1 , System.String , aaa
myProp2 , System.Int64 , 500000
myProp3 , System.String , bbb
myProp4 , System.DateTime , 2005-08-01T10:10:10

I have a base class called MyClass that has 1 property called
currentList. MyClass is already compiled into the currently
running assembly, but in the future it might be in
an assembly in a physically seperate DLL.

I would like to create a new class that inherits from MyClass,
and add all of the properties from the DataTable to the
new child class. How would I do that?

Thanks.


 
Reply With Quote
 
 
 
 
=?Utf-8?B?QnJpYW4gRGVsYWh1bnR5?=
Guest
Posts: n/a
 
      4th Aug 2005
Have a look at the Reflection.Emit namespace. Also, there are lots of
tutorials on Reflection.Emit on MSDN and on a quick msn or google search.

Hope this helps!

Brian Delahunty,
Ireland.

"xenophon" wrote:

>
>
> I have a DataTable with 3 columns in it - Name, Type, Value.
> I have these rows in the DataTable -
> myProp1 , System.String , aaa
> myProp2 , System.Int64 , 500000
> myProp3 , System.String , bbb
> myProp4 , System.DateTime , 2005-08-01T10:10:10
>
> I have a base class called MyClass that has 1 property called
> currentList. MyClass is already compiled into the currently
> running assembly, but in the future it might be in
> an assembly in a physically seperate DLL.
>
> I would like to create a new class that inherits from MyClass,
> and add all of the properties from the DataTable to the
> new child class. How would I do that?
>
> Thanks.
>
>
>

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Assume I create a class Customer is it advice to have a separate class to store addresses Tony Johansson Microsoft C# .NET 6 25th Jan 2011 12:56 AM
runtime error class factory cannot supply class nitin_gregory@infosys.com Microsoft Excel Discussion 0 28th Nov 2006 05:27 AM
Create Class at Runtime? xenophon Microsoft Dot NET Framework 2 5th Aug 2005 10:27 AM
Create a Class at runtime for use with PropertyGrid Chris Dunaway Microsoft VB .NET 1 5th Aug 2004 11:29 PM
abstract class, implementing virtual class loaded at runtime Robb Sadler Microsoft C# .NET 2 11th Oct 2003 03:58 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:35 AM.