Hi Miguel,
there are two ways: Either initalize all values
to some default stuff in the Class Constructor,
or use attributes on the classes like e.g. this:
[CategoryAttribute("Progress Bar"),
Browsable(true),
ReadOnly(false),
BindableAttribute(false),
DefaultValueAttribute(typeof(Color),"DarkGreen"),
DesignOnly(false),
DescriptionAttribute("The Progress Bar Color that will be used to
draw the Progress Bar")]
public Color ProgresBarColor {
get {
return this.colorProgressBar;
}
set {
this.colorProgressBar = value;
this.progressBarBrush = new
SolidBrush(this.colorProgressBar);
}
}
its a piece of code that i use in my extended
progress bar class. See the .NET Documentation
for more information about attributes and the
information about the classes in this example,...
Regards
Kerem
--
-----------------------
Beste Grüsse / Best regards / Votre bien devoue
Kerem Gümrükcü
Latest Project:
http://www.codeplex.com/restarts
Latest Open-Source Projects:
http://entwicklung.junetz.de
-----------------------
"This reply is provided as is, without warranty express or implied."
"shapper" <md*****@gmail.comschrieb im Newsbeitrag
news:9c**********************************@b1g2000h sg.googlegroups.com...
Hello,
I have a class with a few properties:
public class PageViewData {
public string ContentType { get; set; }
public string Keywords { get; set; }
public string Title { get; set; }
}
What is the correct way to define a property default value in case the
property is not defined?
Thank You,
Miguel