当前位置:   article > 正文

C#中File静态类及其常用静态方法实例详解_c# 静态方法和实例方法

c# 静态方法和实例方法

刚才写了一个小的测试程序,全面详述了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的文件必须存在,否则会报错。
   

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/2023面试高手/article/detail/325172
推荐阅读
相关标签
  

闽ICP备14008679号