zoukankan      html  css  js  c++  java
  • C# 文件操作把结果保存到文件里

    什么也不说了,看以下实例。       

       /// <summary>
            /// 获取到的京东系统级参数保存到文件里
            /// </summary>
            /// <param name="authForm"> 窗口类</param>
            void SetInFile(AuthForm authForm)
            {
                //应用程序的可执行文件的路径
                string DirectoryPath = Application.StartupPath + "\\INI";

                //创建目录
                if (!Directory.Exists(DirectoryPath))
                {
                    Directory.CreateDirectory(DirectoryPath);//目录操作
                }

                //创建文件
                string filepath = DirectoryPath + "\\JOS配置信息.ini";//文件操作
                if (File.Exists(filepath))
                {
                    File.Delete(filepath);
                }

                //AppendAllText()有创建文件和写入内容的功能
                File.AppendAllText(filepath, "AppKey:" + authForm.AppKey + "\r\nAppSecret:" + authForm.AppSecret + "\r\nAccessToken:" + authForm.AccessToken.Token + "\r\nDate:" + DateTime.Now.ToString().Trim());

                Console.WriteLine("保存");
            }

  • 相关阅读:
    AC自动机模板
    输入输出外挂(整数)
    前同事通过接私活年入60W,他常用19个私活平台汇总!
    通用分页存储过程
    单品流向
    口令对照表
    连接字符串大全
    各搜索引擎登记入口
    moto手机软件收集
    resin在线客户系统
  • 原文地址:https://www.cnblogs.com/YangBinChina/p/2618428.html
Copyright © 2011-2022 走看看