zoukankan      html  css  js  c++  java
  • 从一个文本文件中读取一组数据放在一个文本框里,然后打印

    
    using System;
    using System.Collections.Generic;
    using System.Text;

    namespace ConsoleApplication1
    {
    class Program
    {
    static void Main(string[] args)
    {

    // The files used here were created in the code example
    // in How to: Write to a Text File. You can of course substitute
    // other files of your own.

    // Example #1
    // Read the file as one string.
    string text = System.IO.File.ReadAllText(@"D:\Test1.txt");

    // Display the file contents to the console.
    System.Console.WriteLine(@"D:\Test1.txt = {0}", text);

    // Example #2
    // Read the file lines into a string array.
    string[] lines = System.IO.File.ReadAllLines(@"D:\Test2.txt");

    System.Console.WriteLine(
    @"D:\Test2.txt =:");
    foreach (string line in lines)
    {
    Console.WriteLine(
    "\t" + line);
    }

    // Keep the console window open in debug mode.
    Console.WriteLine("Press any key to exit.");
    System.Console.ReadKey(); }


    }
    }
  • 相关阅读:
    mac lsof使用查看端口
    mac 安装gevent报错
    vim命令学习
    linux批量关闭进程
    坐标点转换
    screen命令记录
    hashlib模块
    PyYAML和configparser模块讲解
    xml处理模块
    json、pickleshelve模块(超级好用~!)讲解
  • 原文地址:https://www.cnblogs.com/beeone/p/1998290.html
Copyright © 2011-2022 走看看