Click here to Skip to main content
15,897,334 members
Home / Discussions / C#
   

C#

 
GeneralRe: Sereilize a Array List Pin
Heath Stewart4-Feb-04 4:08
protectorHeath Stewart4-Feb-04 4:08 
GeneralRe: Sereilize a Array List Pin
LongRange.Shooter5-Feb-04 2:34
LongRange.Shooter5-Feb-04 2:34 
QuestionHow to display frame or panel on top of DirectDraw video window in Fullscreen mode? Pin
mdundek3-Feb-04 22:34
mdundek3-Feb-04 22:34 
AnswerRe: How to display frame or panel on top of DirectDraw video window in Fullscreen mode? Pin
Heath Stewart4-Feb-04 4:03
protectorHeath Stewart4-Feb-04 4:03 
GeneralDeployment project: adding uninstall icon Pin
Radoslav Bielik3-Feb-04 21:51
Radoslav Bielik3-Feb-04 21:51 
GeneralRe: Deployment project: adding uninstall icon Pin
Mazdak3-Feb-04 23:31
Mazdak3-Feb-04 23:31 
GeneralRe: Deployment project: adding uninstall icon Pin
Radoslav Bielik3-Feb-04 23:43
Radoslav Bielik3-Feb-04 23:43 
GeneralRe: Deployment project: adding uninstall icon Pin
Heath Stewart4-Feb-04 3:55
protectorHeath Stewart4-Feb-04 3:55 
GeneralRe: Deployment project: adding uninstall icon Pin
Heath Stewart4-Feb-04 4:00
protectorHeath Stewart4-Feb-04 4:00 
GeneralRe: Deployment project: adding uninstall icon Pin
Mazdak4-Feb-04 5:27
Mazdak4-Feb-04 5:27 
GeneralRe: Deployment project: adding uninstall icon Pin
Heath Stewart4-Feb-04 5:29
protectorHeath Stewart4-Feb-04 5:29 
GeneralRe: Deployment project: adding uninstall icon Pin
Radoslav Bielik4-Feb-04 20:58
Radoslav Bielik4-Feb-04 20:58 
GeneralRe: Deployment project: adding uninstall icon Pin
Heath Stewart5-Feb-04 4:14
protectorHeath Stewart5-Feb-04 4:14 
GeneralProblem with arrays... Pin
Andres Coder3-Feb-04 21:46
Andres Coder3-Feb-04 21:46 
GeneralRe: Problem with arrays... Pin
Radoslav Bielik3-Feb-04 21:54
Radoslav Bielik3-Feb-04 21:54 
GeneralRe: Problem with arrays... Pin
Andres Coder4-Feb-04 3:29
Andres Coder4-Feb-04 3:29 
GeneralRe: Problem with arrays... Pin
Andres Coder4-Feb-04 3:29
Andres Coder4-Feb-04 3:29 
GeneralRe: Problem with arrays... Pin
Heath Stewart4-Feb-04 3:53
protectorHeath Stewart4-Feb-04 3:53 
GeneralRe: Problem with arrays... Pin
Andres Coder4-Feb-04 23:14
Andres Coder4-Feb-04 23:14 
GeneralRe: Problem with arrays... Pin
Jeff Varszegi12-Mar-04 9:00
professionalJeff Varszegi12-Mar-04 9:00 
QuestionRecord types in C# ? Pin
Andres Coder3-Feb-04 19:59
Andres Coder3-Feb-04 19:59 
AnswerRe: Record types in C# ? Pin
John Kuhn3-Feb-04 20:18
John Kuhn3-Feb-04 20:18 
GeneralRe: Record types in C# ? Pin
Heath Stewart3-Feb-04 20:37
protectorHeath Stewart3-Feb-04 20:37 
Technically, those aren't properties they're fields. The difference is that you can include validation code in property getters and setters (as well as other useful code, like recreating a native window handle or refreshing a drawing surface). With fields, you only get type safety.

To the original poster, you could always use a property to validate a param like so:
private int age;
public int Age
{
  get { return this.age; }
  set
  {
    if (age < 18) throw new ArgumentException("You're too young!", "value");
    this.age = value;
  }
}
Both structs and classes can use properties. If you do use properties (and you typically should), make sure you declare the fields as protected or private. If you're going to validate values using properties, make sure you force callers.

 

Microsoft MVP, Visual C#
My Articles
GeneralRe: Record types in C# ? Pin
John Kuhn3-Feb-04 20:43
John Kuhn3-Feb-04 20:43 
GeneralRe: Record types in C# ? Pin
Andres Coder3-Feb-04 20:45
Andres Coder3-Feb-04 20:45 

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.