赞
踩
刚才写了一个小的测试程序,全面详述了c#中的关于文件操作的各种静态方法的用法,现分享一下----------YYC
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;
namespace PraccticeInDetail
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
File.Copy("E:\\a.txt","F:\\b.txt");
/*
* File.Copy(path1, path2);
* 文件路径中必须包含文件名,且两个文件名可以相同。
* 把path1的文件复制到path2
* path1的文件必须存在,否则会报错。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。