stefan1919

Structure Using Array

Oct 31st, 2015
175
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.96 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 ModuleThreeAssignment
  8. {
  9.     class Program
  10.     {
  11.         enum Days { Monday, Thursday, Wednesday, Thuesday, Friday, Saturday, Sunday };
  12.         public struct Menu
  13.         {
  14.             private string[] beverages;
  15.             // This is the indexer.
  16.             public string this[int index]
  17.             {
  18.                 get { return this.beverages[index]; }
  19.                 set { this.beverages[index] = value; }
  20.             }
  21.             // Enable client code to determine the size of the collection.
  22.             public int Length
  23.             {
  24.                 get { return beverages.Length; }
  25.             }
  26.         }
  27.         static void Main(string[] args)
  28.         {
  29.             Menu myMenu = new Menu();
  30.             string firstDrink = myMenu[0];
  31.             int numberOfChoices = myMenu.Length;
  32.         }
  33.     }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment