Advertisement
wingman007

OOP_C#_Program_Indexer_default_params

Apr 5th, 2018
209
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.85 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace WorldMI
  8. {
  9.   class Program
  10.   {
  11.     static void Main(string[] args)
  12.     {
  13.       Person stoyan = new Person("Stoyan", 54, 345.67M, "Koce", "Ralica", "Ivancho");
  14.       //stoyan.Name = "Stoyan";
  15.       //stoyan.Age = -700;
  16.  
  17.       Person koce = new Person(age: 18, name: "Koce"); // named arguments mus appear after all fixed arguments
  18.       //koce.Name = "Koce";
  19.       //koce.Age = 18;
  20.  
  21.       //Console.WriteLine("My name is {0}. I am {1} years old!", stoyan.Name, stoyan.Age);
  22.  
  23.       //Console.WriteLine("My name is {0}. I am {1} years old!", koce.Age, koce.Age);
  24.  
  25.       stoyan.IntroduceYourSelf();
  26.       koce.IntroduceYourSelf();
  27.  
  28.       Console.WriteLine("The first friend of Stoyan is {0}", stoyan[0]);
  29.  
  30.     }
  31.   }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement