Advertisement
Aborigenius

ClassCreation

Aug 18th, 2017
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.04 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 Lesson
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             Hero Pesho = new Hero
  14.             {
  15.                 SecretName = "Super Pesho",
  16.                 SuperPower = "Rakia Drinking",
  17.                 Age = 73
  18.             };
  19.  
  20.             Hero Gosho = new Hero
  21.             {
  22.                 SecretName = "Super Gosho",
  23.                 SuperPower = "Vodka Drinking",
  24.                 Age = 89
  25.             };
  26.  
  27.             List <Hero>heroes = new List<Hero>();
  28.             heroes.Add(Pesho);
  29.             heroes.Add(Gosho);
  30.  
  31.             foreach (Hero hero in heroes)
  32.             {
  33.                 Console.WriteLine(hero.SecretName + " <=> " + hero.SuperPower);
  34.             }
  35.  
  36.          
  37.         }
  38.     }
  39.     class Hero
  40.     {
  41.         public string SecretName { get; set; }
  42.         public string SuperPower { get; set; }
  43.         public int Age { get; set; }
  44.     }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement