Hi,
with this code, i get nothing. It's because the array in class View is empty. Yet, the method Show() starts after the array is filled in Main. How can i show those data in method Show()?
Thanks
V.
using System; class Stman { public string[] Name = new string[3]; static void Main(string[] args) { Stman myObj = new Stman(); View dat = new View();
myObj.Name[0] = "Macron"; myObj.Name[1] = "Rutte"; myObj.Name[2] = "Sunak"; dat.Show(); } }
class View { public void Show() { Stman myObj = new Stman(); for (int i = 0; i < myObj.Name.Length; i++) Console.WriteLine(myObj.Name[i]); } }