Advertisement
Guest User

Person

a guest
Jul 7th, 2019
305
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.67 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4.  
  5. namespace Person
  6. {
  7.     public class Person
  8.     {
  9.         public Person(string name, int age)
  10.         {
  11.             this.Name = name;
  12.             this.Age = age;
  13.         }
  14.  
  15.         public string Name { get; set; }
  16.  
  17.         public int Age { get; set; }
  18.  
  19.         public override string ToString()
  20.         {
  21.             StringBuilder stringBuilder = new StringBuilder();
  22.             stringBuilder.Append(String.Format("Name: {0}, Age: {1}",
  23.                                  this.Name,
  24.                                  this.Age));
  25.  
  26.             return stringBuilder.ToString();
  27.         }
  28.  
  29.     }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement