6237 Programmering II (Csharp) Agenda/File browser

From Teknologisk videncenter
< 6237 Programmering II (Csharp) Agenda
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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");