Advertisement
ptrelford

Person class

Apr 26th, 2012
252
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.64 KB | None | 0 0
  1. // C# class From MSDN: http://msdn.microsoft.com/en-us/library/aa288470(v=vs.71).aspx
  2.  
  3. class Person
  4. {
  5.     private string myName ="N/A";
  6.     private int myAge = 0;
  7.  
  8.     // Declare a Name property of type string:
  9.     public string Name
  10.     {
  11.         get
  12.         {
  13.            return myName;
  14.         }
  15.         set
  16.         {
  17.            myName = value;
  18.         }
  19.     }
  20.  
  21.     // Declare an Age property of type int:
  22.     public int Age
  23.     {
  24.         get
  25.         {
  26.            return myAge;
  27.         }
  28.         set
  29.         {
  30.            myAge = value;
  31.         }
  32.     }
  33. }
  34.  
  35. // F#: 1 line
  36.  
  37. type Person = { Name:string; Age:int }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement