国产亚洲精品福利在线无卡一,国产精久久一区二区三区,亚洲精品无码国模,精品久久久久久无码专区不卡

當(dāng)前位置: 首頁 > news >正文

有什么好看的網(wǎng)站seo系統(tǒng)培訓(xùn)

有什么好看的網(wǎng)站,seo系統(tǒng)培訓(xùn),免費(fèi)建設(shè)展示網(wǎng)站,網(wǎng)站搜索優(yōu)化價格文件寫入 using System.Collections.Generic; namespace demo1;/// <summary> /// System.IO下的所有的Stream類是所有數(shù)據(jù)流的基類 /// 流是用于傳輸數(shù)據(jù)的對象&#xff0c;流就是用來傳輸數(shù)據(jù)的 /// 數(shù)據(jù)傳輸?shù)膬煞N方式&#xff1a;1、數(shù)據(jù)從外部源傳輸?shù)匠绦蛑?amp;#…

文件寫入

using System.Collections.Generic;
namespace demo1;/// <summary>
/// System.IO下的所有的Stream類是所有數(shù)據(jù)流的基類
/// 流是用于傳輸數(shù)據(jù)的對象,流就是用來傳輸數(shù)據(jù)的
/// 數(shù)據(jù)傳輸?shù)膬煞N方式:1、數(shù)據(jù)從外部源傳輸?shù)匠绦蛑?#xff0c;這種叫做讀取流,2、數(shù)據(jù)從程序中傳輸?shù)酵獠吭?#xff0c;這種叫做寫入流
/// 流一般具有三種操作:
/// 讀取操作:讀出流對象中的數(shù)據(jù),并且把它存放在另外一個數(shù)據(jù)結(jié)構(gòu)中
/// 寫入操作:從一種數(shù)據(jù)結(jié)構(gòu)中讀取數(shù)據(jù)并且存放在流對象中
/// 搜索操作:從流中當(dāng)前位置搜索到指定位置
/// </summary>
class proj
{internal static void Main(string[] args){//文件流:用來實(shí)現(xiàn)對文件的讀取和寫入。//文本文件的寫入和讀取//FileStream類的對象只能以字節(jié)的形式讀取和寫入數(shù)據(jù)//StreamReader類允許直接將字符和字符串寫入文件,一般不針對二進(jìn)制數(shù)據(jù)string path = "E:\\Desktop\\c#\\ConsoleApp1\\ConsoleApp1\\hello.txt";string mystr = "我愛你";//一般先創(chuàng)建FileStream對象,然后創(chuàng)建StreamWriter對象FileStream fs = new FileStream(path, FileMode.OpenOrCreate);StreamWriter sw=new StreamWriter(fs);sw.WriteLine(mystr);sw.Close();Console.WriteLine("寫入完成");}
}

文件的讀取

using System.Collections.Generic;
namespace demo1;
using System.IO;
/// <summary>
/// System.IO下的所有的Stream類是所有數(shù)據(jù)流的基類
/// 流是用于傳輸數(shù)據(jù)的對象,流就是用來傳輸數(shù)據(jù)的
/// 數(shù)據(jù)傳輸?shù)膬煞N方式:1、數(shù)據(jù)從外部源傳輸?shù)匠绦蛑?#xff0c;這種叫做讀取流,2、數(shù)據(jù)從程序中傳輸?shù)酵獠吭?#xff0c;這種叫做寫入流
/// 流一般具有三種操作:
/// 讀取操作:讀出流對象中的數(shù)據(jù),并且把它存放在另外一個數(shù)據(jù)結(jié)構(gòu)中
/// 寫入操作:從一種數(shù)據(jù)結(jié)構(gòu)中讀取數(shù)據(jù)并且存放在流對象中
/// 搜索操作:從流中當(dāng)前位置搜索到指定位置
/// </summary>
class proj
{internal static void Main(string[] args){//文件流:用來實(shí)現(xiàn)對文件的讀取和寫入。//文本文件的寫入和讀取//FileStream類的對象只能以字節(jié)的形式讀取和寫入數(shù)據(jù)//StreamReader類允許直接將字符和字符串寫入文件,一般不針對二進(jìn)制數(shù)據(jù)string path = "E:\\Desktop\\c#\\ConsoleApp1\\ConsoleApp1\\hello.txt";//string mystr = "我愛你";//一般先創(chuàng)建FileStream對象,然后創(chuàng)建StreamWriter對象//FileStream fs = new FileStream(path, FileMode.OpenOrCreate);//StreamWriter sw=new StreamWriter(fs);//sw.WriteLine(mystr);//sw.Close();//Console.WriteLine("寫入完成");//StreamReader類  用于從文件中讀取數(shù)據(jù),該類是一個通用類,可以用于任意流FileStream fs=new FileStream(path,FileMode.OpenOrCreate);string str = "";StreamReader sr = new StreamReader(fs);str=sr.ReadLine();sr.Close();Console.WriteLine(str); }
}

二進(jìn)制文件的寫入與讀取

using System.Collections.Generic;
namespace demo1;
using System.IO;
/// <summary>
/// System.IO下的所有的Stream類是所有數(shù)據(jù)流的基類
/// 流是用于傳輸數(shù)據(jù)的對象,流就是用來傳輸數(shù)據(jù)的
/// 數(shù)據(jù)傳輸?shù)膬煞N方式:1、數(shù)據(jù)從外部源傳輸?shù)匠绦蛑?#xff0c;這種叫做讀取流,2、數(shù)據(jù)從程序中傳輸?shù)酵獠吭?#xff0c;這種叫做寫入流
/// 流一般具有三種操作:
/// 讀取操作:讀出流對象中的數(shù)據(jù),并且把它存放在另外一個數(shù)據(jù)結(jié)構(gòu)中
/// 寫入操作:從一種數(shù)據(jù)結(jié)構(gòu)中讀取數(shù)據(jù)并且存放在流對象中
/// 搜索操作:從流中當(dāng)前位置搜索到指定位置
/// </summary>
class proj
{internal static void Main(string[] args){Console.WriteLine("二進(jìn)制文件的寫入");Console.WriteLine("請輸入文件名");string path=Console.ReadLine();//初始化FileStream對象FileStream fs=new FileStream(path, FileMode.OpenOrCreate);//初始化一個BinaryWriter對象BinaryWriter bw=new BinaryWriter(fs);int a = 40;double b = 3.14;bool c = true;string d = "hello world";//寫入文件bw.Write(a);bw.Write(b);bw.Write(c);bw.Write(d);Console.WriteLine("成功寫入");bw.Close();  //關(guān)閉BinaryWriter對象fs.Close();  //關(guān)閉文件流Console.WriteLine("二進(jìn)制文件的讀取");BinaryReader br=new BinaryReader(new FileStream(path,FileMode.Open));int e = br.ReadInt32();Console.WriteLine("int 型整型數(shù)據(jù)\t{0}",e);double f = br.ReadDouble();Console.WriteLine("double 數(shù)據(jù) \t{0}",f);bool g = br.ReadBoolean();Console.WriteLine("bool 數(shù)據(jù) \t{0}", g);string h = br.ReadString();Console.WriteLine("字符串類型數(shù)據(jù)\t{0}", h);br.Close();Console.WriteLine("讀取完成");}
}

c#遍歷文件夾

using System.Collections.Generic;
namespace demo1;
using System.IO;
using System.Drawing;class proj
{internal static void Main(string[] args){DirectoryInfo dir = new DirectoryInfo("E:\\Desktop\\c#\\data");FileSystemInfo[] fs=dir.GetFileSystemInfos();foreach(FileSystemInfo i in fs){if ( i is DirectoryInfo){Console.WriteLine("是文件夾{0}",i.FullName);string [] a=Directory.GetFiles(i.FullName);foreach (string s in a){ Console.WriteLine("文件:{0}",s);}}else{Console.WriteLine("不是文件夾{0}",i.FullName);FileStream fb=File.OpenRead("E:\\Desktop\\c#\\data\\data\\apple_1.jpg");int file_lenth=(int)fb.Length;Byte[] image = new Byte[file_lenth]; //建立一個字節(jié)數(shù)組fb.Read(image,0, file_lenth );//按字節(jié)流讀取}}}
}

在這里插入圖片描述

http://aloenet.com.cn/news/41840.html

相關(guān)文章:

  • 如何侵入網(wǎng)站服務(wù)器免費(fèi)企業(yè)黃頁查詢官網(wǎng)
  • 宜興網(wǎng)站制作百度seo優(yōu)化及推廣
  • 政府網(wǎng)站建設(shè)運(yùn)行情況寧波seo免費(fèi)優(yōu)化軟件
  • 新網(wǎng)站優(yōu)化怎么做武漢seo優(yōu)化
  • 界面網(wǎng)站的風(fēng)格關(guān)鍵字c語言
  • 成都哪里有做網(wǎng)站建設(shè)的青島網(wǎng)站建設(shè)公司電話
  • 在小說網(wǎng)站做責(zé)編如何免費(fèi)發(fā)布廣告
  • 網(wǎng)站制作公司智能 樂云踐新做網(wǎng)站怎么優(yōu)化
  • 網(wǎng)站模板購買房地產(chǎn)估價師考試
  • 小程序開發(fā)平臺哪里做得好seo網(wǎng)站優(yōu)化培訓(xùn)怎么做
  • 可以免費(fèi)發(fā)帖的網(wǎng)站品牌廣告投放
  • asp如何做網(wǎng)站河北網(wǎng)站seo策劃
  • 網(wǎng)站瀏覽思路上海網(wǎng)絡(luò)推廣公司網(wǎng)站
  • 哪個網(wǎng)站推廣做的好引流獲客app下載
  • 關(guān)于藥品網(wǎng)站建設(shè)策劃書seo軟件哪個好
  • 做網(wǎng)站公司在深圳杭州疫情最新情況
  • 網(wǎng)站建設(shè)在線視頻上海百度推廣官網(wǎng)
  • java源代碼網(wǎng)站seo在線外鏈
  • 企業(yè)網(wǎng)站建設(shè)系統(tǒng)惠東seo公司
  • 邯鄲哪有做網(wǎng)站的公司邵陽網(wǎng)站seo
  • 網(wǎng)站開發(fā)原型濰坊今日頭條新聞
  • 濰坊市建設(shè)局網(wǎng)站上海關(guān)鍵詞自動排名
  • 網(wǎng)站源碼上傳完后怎么做足球排名最新排名世界
  • 怎么給企業(yè)做網(wǎng)站網(wǎng)絡(luò)營銷企業(yè)是什么
  • 網(wǎng)站策劃書十大外貿(mào)電商平臺
  • 邯鄲網(wǎng)站建設(shè)縱橫廣告軟文怎么寫
  • 中華南大街網(wǎng)站建設(shè)佛山百度網(wǎng)站排名優(yōu)化
  • 深圳網(wǎng)站建設(shè)公司哪家專業(yè)今日國內(nèi)新聞10則
  • 如何制作網(wǎng)站平臺北京aso優(yōu)化
  • 銷項(xiàng)稅和進(jìn)項(xiàng)導(dǎo)入是在國稅網(wǎng)站做嗎制作網(wǎng)站費(fèi)用