Why am I Getting A INDEXOUTOFBOUNDS EXCEPTION... Please assist and tell me where i am going wrong. I am a new programmer. Here is the code;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
namespace ArrayTextFile
{
class Program
{
static void Main(string[] args)
{
string filename = "C:\\Users\\Kayloz\\Desktop\\Array.txt";
System.IO.StreamWriter W;
W = new System.IO.StreamWriter(filename);
int i;
string[] names = {"Anthony ","Paul ","Zlatan ","David ","Wayne ","Jose ","Marcus ","Daley","Inez ","Juan "};
for (i = 0; i < names.Length; i++) ;
W.Write(names[i]);
W.Close();
}
}
}