6237 Programmering II (Csharp) Agenda/File browser

From Teknologisk videncenter
< 6237 Programmering II (Csharp) Agenda
Revision as of 19:18, 22 September 2015 by Orso (talk | contribs) (Created page with "===Directory=== Hvis du gerne vil arbejde med filerne på din computer kan det gøres med Directory. <source lang=csharp> String[] dirs = Directory.GetDirectories("C:\\"); fo...")
(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");