读取磁盘(c#流 文件)

来源:互联网 发布:小天才电话手表软件 编辑:程序博客网 时间:2024/05/22 02:23
 using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;using System.IO;namespace xianshi{    public partial class Form1 : Form    {        public Form1()        {            InitializeComponent();        }        private void Form1_Load(object sender, EventArgs e)        {            DriveInfo[] di = DriveInfo.GetDrives();            foreach (DriveInfo d in di) {                comboBox1.Items.Add(d.Name);            }        }        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)        {            treeView1.Nodes.Clear();            foreach (string str in Directory.GetDirectories(comboBox1.Text)) {                TreeNode node = new TreeNode();                node.Text = str;                treeView1.Nodes.Add(node);                        }        }    }}
c#简单的读取文件
0 0