Difference between revisions of "6237 Programmering II (Csharp) Agenda/File browser"

From Teknologisk videncenter
Jump to: navigation, search
(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...")
 
 
(One intermediate revision by the same user not shown)
Line 22: Line 22:
  
  
[[Category:Csharp]]
+
[[Category:6237 Programmering II]]

Latest revision as of 11:22, 7 October 2015

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");