Drive(s)

System.IO.DriveInfo[] _allDrives = System.IO.DriveInfo.GetDrives(); foreach (System.IO.DriveInfo _Drive in _allDrives) { System.Windows.Forms.MessageBox.Show(_Drive.TotalSize.ToString()); System.Windows.Forms.MessageBox.Show(_Drive.TotalFreeSpace.ToString()); }

By |2015-06-15T21:51:29+02:00June 15th, 2015|0 Comments

StreamWriter

string _FileText = "some text"; using (System.IO.StreamWriter _StreamWriter = new System.IO.StreamWriter("PathFile")) { _StreamWriter.Write(_FileText); _StreamWriter.Flush(); } using (System.IO.StreamWriter _StreamWriter = new System.IO.StreamWriter("PathFile")) { foreach (System.IO.DirectoryInfo _DirectoryInfo in new DirectoryInfo(@"c:\").GetDirectories()) { _StreamWriter.WriteLine(_DirectoryInfo.Name); } } MSDN Artikel

By |2015-06-14T13:44:36+02:00June 14th, 2015|0 Comments

StreamReader

string _FileText; using (System.IO.StreamReader _StreamReader = new System.IO.StreamReader("PathFile")) { _FileText = _StreamReader.ReadToEnd(); } string _TextLine; using (System.IO.StreamReader _StreamReader = new System.IO.StreamReader("PathFile")) { while ((_TextLine = _StreamReader.ReadLine()) != null) { Console.WriteLine(_TextLine); } } MSDN Artikel

By |2015-06-14T13:36:55+02:00June 14th, 2015|0 Comments
Go to Top