6237 Programmering II (Csharp) Agenda/File browser

From Teknologisk videncenter
< 6237 Programmering II (Csharp) Agenda
Revision as of 14:31, 29 September 2015 by Orso (talk | contribs) (Directory)
Jump to: navigation, search

Directory

Hvis du gerne vil arbejde med filerne på din computer kan det gøres med Directory.


String[] dirs = Directory.GetDirectories("C:\\");
foreach (string dir in dirs)
{
	System.Console.WriteLine(dir);
}

String[] files = Directory.GetFiles("C:\\");
foreach (string file in files)
{
	System.Console.WriteLine(file);
}

File.Copy("xxx.txt", "yyy.txt");
File.Delete("xxx.txt");