Use of Streamwriter/Reader and Arraylist in C#
"//Use of Streamwriter/Reader and Arraylist in C#
StreamWriter exportfile = new StreamWriter("C:\\temp\\ExportFile.txt");
//
//
ArrayList mylist = new ArrayList();
StreamReader sr = new StreamReader("C:\\temp\\shadow");
string line;
while((line=sr.ReadLine())!= null)
{
mylist.Add(line);
}
int count = mylist.Count;
string[] userarray;
ArrayList username = new ArrayList();
for(int i=0; i
string users = mylist[i].ToString();
userarray= users.Split(Convert.ToChar(":"));
username.Add(userarray[0].ToString());
}
for(int j=0; j
exportfile.WriteLine("objType:person");
exportfile.WriteLine("givenName:" + username[j].ToString());
exportfile.WriteLine("name:" + username[j].ToString());
exportfile.WriteLine("userid:" + username[j].ToString());
exportfile.WriteLine("displayName:" + username[j].ToString());
exportfile.WriteLine();
}
// Console.ReadLine();
exportfile.Close(); "
1 Comments:
Thanks for writing this.
Post a Comment
Subscribe to Post Comments [Atom]
<< Home