Click here to Skip to main content
15,911,646 members
Home / Discussions / C#
   

C#

 
AnswerRe: Current Cell Back Color in a DataGrid? Pin
Heath Stewart2-Apr-04 9:37
protectorHeath Stewart2-Apr-04 9:37 
GeneralDatagrid, handling events Pin
benqazou2-Apr-04 5:09
benqazou2-Apr-04 5:09 
GeneralRe: Datagrid, handling events Pin
Heath Stewart2-Apr-04 9:39
protectorHeath Stewart2-Apr-04 9:39 
GeneralPassing data to a form. Pin
Demian Panello2-Apr-04 4:58
Demian Panello2-Apr-04 4:58 
GeneralRe: Passing data to a form. Pin
CWIZO2-Apr-04 8:01
CWIZO2-Apr-04 8:01 
GeneralRe: Passing data to a form. Pin
Heath Stewart2-Apr-04 9:42
protectorHeath Stewart2-Apr-04 9:42 
GeneralRe: Passing data to a form. Pin
Demian Panello2-Apr-04 13:26
Demian Panello2-Apr-04 13:26 
GeneralPersistant DefaultValueAttributes Pin
ajenny2-Apr-04 4:04
ajenny2-Apr-04 4:04 
Hi,
Let's have a dream. I have a class with some properties, here a sample :
public class TestClass<br />
{<br />
   private int myint;<br />
   private string mystring = "";<br />
<br />
   public TestClass() { }<br />
<br />
   [DefaultValue(100)]<br />
   public int IntProp<br />
   {<br />
      get { return myint; }<br />
      set { myint = value; }<br />
   }<br />
<br />
   [DefaultValue("idea")]<br />
   public string StringProp<br />
   {<br />
      get { return mystring ; }<br />
      set { mystring = value; }<br />
   }<br />
}


I wonder if it is possible to set at runtime the DefaultValue for every properties. My wish is to be able to serialize theses values. So at next startup, the new defaultvalues will be used.
So what are the issues ?
- It's straightforward to enumerate the current DefaultValueAttribute of every properties.
- I think I have to use the ICustomTypeDescriptor to get a dynamic defaultValue attribute.
- I really don't know where to put the serialization and deserialization code for putting and getting back the default values. Constructor ? Desctructor ?
- Another point, by setting the DefaultValueAttribute of one propertie, will it be set for every instance of the class ?

Thanks for helping me.



---
Alexandre Jenny
GeneralRe: Persistant DefaultValueAttributes Pin
Heath Stewart2-Apr-04 9:45
protectorHeath Stewart2-Apr-04 9:45 
GeneralUpdating Controls included in other controls Pin
veroBT2-Apr-04 4:02
veroBT2-Apr-04 4:02 
GeneralRe: Updating Controls included in other controls Pin
Heath Stewart2-Apr-04 9:47
protectorHeath Stewart2-Apr-04 9:47 
QuestionSsh in c#?? Pin
polkiujhy2-Apr-04 3:44
polkiujhy2-Apr-04 3:44 
AnswerRe: Ssh in c#?? Pin
Dave Kreskowiak2-Apr-04 4:08
mveDave Kreskowiak2-Apr-04 4:08 
GeneralRe: Ssh in c#?? Pin
polkiujhy2-Apr-04 5:43
polkiujhy2-Apr-04 5:43 
GeneralRe: Ssh in c#?? Pin
Dave Kreskowiak2-Apr-04 5:48
mveDave Kreskowiak2-Apr-04 5:48 
GeneralRe: Ssh in c#?? Pin
Heath Stewart2-Apr-04 9:50
protectorHeath Stewart2-Apr-04 9:50 
GeneralPlease Help Pin
Nicholas Naddaf2-Apr-04 3:30
Nicholas Naddaf2-Apr-04 3:30 
QuestionC# syntax question? Pin
Anonymous2-Apr-04 3:12
Anonymous2-Apr-04 3:12 
AnswerRe: C# syntax question? Pin
Grimolfr2-Apr-04 3:41
Grimolfr2-Apr-04 3:41 
AnswerRe: C# syntax question? Pin
Dave Kreskowiak2-Apr-04 4:04
mveDave Kreskowiak2-Apr-04 4:04 
GeneralSerializing a Winform Pin
anand9112-Apr-04 0:48
anand9112-Apr-04 0:48 
GeneralRe: Serializing a Winform Pin
Dave Kreskowiak2-Apr-04 4:36
mveDave Kreskowiak2-Apr-04 4:36 
GeneralRe: Serializing a Winform Pin
Stefan Troschuetz2-Apr-04 5:57
Stefan Troschuetz2-Apr-04 5:57 
GeneralRe: Serializing a Winform Pin
Heath Stewart2-Apr-04 9:53
protectorHeath Stewart2-Apr-04 9:53 
QuestionStatic Arraylist? Pin
SherKar1-Apr-04 21:48
SherKar1-Apr-04 21:48 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.