rei
New member
- Joined
- Sep 2, 2015
- Messages
- 4
- Programming Experience
- Beginner
using System; namespace C_Sharp_Practice { class MainClass { public static void Main (string[] args) { string[] FavoriteFoods = new string[5]; FavoriteFoods[0] = "Apples"; FavoriteFoods[1] = "Carrots"; FavoriteFoods[2] = "Steak"; FavoriteFoods[3] = "Pizza"; FavoriteFoods[4] = "Spahgetti"; Console.WriteLine(FavoriteFoods.Length); } public void ListFoods() { int i = 0; while (i < FavoriteFoods.Length) { i = i + 1; Console.WriteLine(FavoriteFoods); } } } } ///I'm kinda new to C#. I'm thinking that my 'ListFoods' method doesn't have access to the contents of my 'Main' method. Anyone know what's the problem?
Last edited: