PC Review


Reply
Thread Tools Rate Thread

create class with dynamic properties

 
 
davidw
Guest
Posts: n/a
 
      20th Jul 2006
I found it seems there is a way to create a class with dynamic properties, I
don't really need define each property?

In ASP.NET, Profile is created with all profile items in web.config as its
properties, I found it has code like this:

public static SettingsPropertyCollection Properties
{
get
{
ProfileBase.InitializeStatic();
return ProfileBase.s_Properties;
}
}

I an not quite sure how it works, but in most case, I would like properties
of some of my class are controlled by code, that means I don't need define
those properties before compilation, could anyone tell me how I do that?

thanks!


 
Reply With Quote
 
 
 
 
Ben Voigt
Guest
Posts: n/a
 
      20th Jul 2006

"davidw" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>I found it seems there is a way to create a class with dynamic properties,
>I
> don't really need define each property?
>
> In ASP.NET, Profile is created with all profile items in web.config as its
> properties, I found it has code like this:
>
> public static SettingsPropertyCollection Properties
> {
> get
> {
> ProfileBase.InitializeStatic();
> return ProfileBase.s_Properties;
> }
> }
>
> I an not quite sure how it works, but in most case, I would like
> properties
> of some of my class are controlled by code, that means I don't need define
> those properties before compilation, could anyone tell me how I do that?


I think ASP.NET requires web.config to be available during compilation.

However a Dictionary object will give you just about the effect you are
looking for.

>
> 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
How to handle dynamic Array properties in a class module? deltaquattro Microsoft Excel Programming 2 15th Mar 2010 01:24 PM
Trying to create a dynamic class...? Gorfy Microsoft C# .NET 3 21st Sep 2008 03:19 PM
Accessing class properties with dynamic name Amy Blankenship Microsoft Access Form Coding 0 5th Dec 2007 08:51 PM
Dynamic Class Properties from Data Row Columns Brent Microsoft C# .NET 1 20th Sep 2005 03:07 AM
ArrayList of custom class with dynamic properties not displayed correctly in DataGrid raymi Microsoft C# .NET 2 15th Jul 2005 09:03 AM


Features
 

Advertising
 

Newsgroups
 


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