Advertisement
Guest User

to string

a guest
Nov 28th, 2014
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.76 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. namespace ConsoleApplication3
  6. {
  7.     class anas
  8.     {
  9.  
  10.         private string name;
  11.         private int age;
  12.  
  13.  
  14.         public string Name
  15.         {
  16.             get { return name;}
  17.             set { name=value;}
  18.         }
  19.  
  20.         public int Age
  21.         {
  22.             get { return age;}
  23.             set { age=value;}
  24.         }
  25.         public override string ToString()
  26.         {
  27.             return "Name = " + Name + ", Age = " + Age ;
  28.         }
  29.         public static void Main(string[] args)
  30.         {
  31.             anas a = new anas();
  32.             a.name = "anas";
  33.             a.age = 19;
  34.             Console.WriteLine(a);
  35.         }
  36.  
  37.  
  38.     }
  39.  
  40.  
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement