c#幻灯片源代码 public void test() { string path=(@"C:\\Documents and Settings\Administrator\桌面\img"); DirectoryInfo di = new DirectoryInfo(path); FileInfo[] fi = di.GetFiles("*.jpg"); progressBar1.Maximum = fi.Length; //progressBar1.Value = 0; int i = 0;
C# 保存文件到数据库字段 attach new BusAttach ; FileInfo fi new FileInfo txtAttach Text Trim ; attach Fix fi Extension Substring 1 ToLower Trim ; FileStream fs fi OpenRead ; byte[] bytes new byte[fs Length]; fs Read bytes 0 Convert ToInt32 fs Length ; fs Close
c#核心代码: 代码如下: DirectoryInfo dir = new DirectoryInfo(strPath); foreach (FileInfo fi in dir.GetFiles(“*.doc”)) { if (fi.FullName.EndsWith(“.doc”)) // 将 docx 类型的文件过滤掉 { // 这个 fi 就是你要的 doc 文件 Console.WriteLine(fi.Name); } }
您可能感兴
一、DataTable数据写入CSV文件
public static void SaveCSV(DataTable dt, string fullPath)//table数据写入csv
{
System.IO.FileInfo fi = new System.IO.FileInfo(fullPath);
if (!fi.Directory.Exists)
{
fi.Directory.Create();
}
System.IO.FileStream fs = new