SlideShare a Scribd company logo
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Please enter a name for the new directory:");
string DirName = Console.ReadLine();
// Checking if string is empty or not
if (DirName != String.Empty)
{
// Creating the Directory
Directory.CreateDirectory("D:"+DirName);
// Checking Directory is created
// Successfully or not
if (Directory.Exists(DirName))
{
Console.WriteLine("The directory was created!");
Console.ReadKey();
}
}
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Enter the directory name you want to delete:");
string DirName = Console.ReadLine();
if (Directory.Exists("D://"+DirName))
{
Directory.Delete("D://"+DirName);
if(Directory.Exists("D://"+DirName) == false)
{
Console.WriteLine("Directory deleted successfully...");
}
}
else
{
Console.WriteLine("Directory {0} does not exist!", DirName);
Console.ReadLine();
}
}
}
}
C# - Stream
C# includes following standard IO (Input/Output) classes to read/write from different sources like files, memory,
network, isolated storage, etc.
Stream: System.IO.Stream is an abstract class that provides standard methods to transfer bytes (read, write,
etc.) to the source. It is like a wrapper class to transfer bytes. Classes that need to read/write bytes from a
particular source must implement the Stream class.
StreamReader: StreamReader is a helper class for reading characters from a Stream by converting bytes into
characters using an encoded value. It can be used to read strings (characters) from different Streams like
FileStream, MemoryStream, etc.
StreamWriter: StreamWriter is a helper class for writing a string to a Stream by converting characters into
bytes. It can be used to write strings to different Streams such as FileStream, MemoryStream, etc.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
//Create object of FileInfo for specified path
FileInfo fi = new FileInfo(@"D:skcollegeDummyFile.txt");
//Open file for ReadWrite
FileStream fs = fi.Open(FileMode.OpenOrCreate,FileAccess.Write, FileShare.Write);
//Create StreamWriter object to write string to FileSream
StreamWriter sw = new StreamWriter(fs);
sw.WriteLine("line 1 from streamwriter");
sw.WriteLine("line 2 line from streamwriter");
sw.Close();
}
}
}
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
FileInfo fi = new FileInfo(@"D:skcollegeDummyFile.txt");
FileStream fs = fi.Open(FileMode.Open, FileAccess.Read, FileShare.Read);
StreamReader sr = new StreamReader(fs);
string fileContent = sr.ReadToEnd();
Console.WriteLine(fileContent);
sr.Close();
fs.Close();
Console.ReadLine();
// Line by Line Reading
1.// Write file contents on console.
2. using (StreamReader sr = File.OpenText(fileName))
3. {
4. string s = "";
5. while ((s = sr.ReadLine()) != null)
6. {
7. Console.WriteLine(s);
8. }
9. }
}
}
}
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
The BinaryReader and BinaryWriter classes are used for reading from and writing to a binary file.
The BinaryReader and BinaryWriter classes are used for reading from and writing to a binary file.

More Related Content

Similar to using System.docx

Description 1) Create a Lab2 folder for this project2.docx
Description       1)  Create a Lab2 folder for this project2.docxDescription       1)  Create a Lab2 folder for this project2.docx
Description 1) Create a Lab2 folder for this project2.docx
theodorelove43763
 
ASP.NET Session 7
ASP.NET Session 7ASP.NET Session 7
ASP.NET Session 7
Sisir Ghosh
 
Create a text file named lnfo.txt. Enter the following informatio.pdf
Create a text file named lnfo.txt. Enter the following informatio.pdfCreate a text file named lnfo.txt. Enter the following informatio.pdf
Create a text file named lnfo.txt. Enter the following informatio.pdf
shahidqamar17
 
Java I/o streams
Java I/o streamsJava I/o streams
Java I/o streams
Hamid Ghorbani
 
File handling
File handlingFile handling
File handling
prateekgemini
 
File Handling in Java.pdf
File Handling in Java.pdfFile Handling in Java.pdf
File Handling in Java.pdf
SudhanshiBakre1
 
Chapter 11
Chapter 11Chapter 11
Chapter 11
Terry Yoast
 
Whitepaper To Study Filestream Option In Sql Server
Whitepaper To Study Filestream Option In Sql ServerWhitepaper To Study Filestream Option In Sql Server
Whitepaper To Study Filestream Option In Sql Server
Shahzad
 
Unix lab
Unix labUnix lab
09.Local Database Files and Storage on WP
09.Local Database Files and Storage on WP09.Local Database Files and Storage on WP
09.Local Database Files and Storage on WP
Nguyen Tuan
 
Srgoc dotnet
Srgoc dotnetSrgoc dotnet
Srgoc dotnet
Gaurav Singh
 
File Handling.pptx
File Handling.pptxFile Handling.pptx
File Handling.pptx
PragatiSutar4
 
15. Streams Files and Directories
15. Streams Files and Directories 15. Streams Files and Directories
15. Streams Files and Directories
Intro C# Book
 
Java căn bản - Chapter12
Java căn bản - Chapter12Java căn bản - Chapter12
Java căn bản - Chapter12
Vince Vo
 
Chapter 12 - File Input and Output
Chapter 12 - File Input and OutputChapter 12 - File Input and Output
Chapter 12 - File Input and Output
Eduardo Bergavera
 
Devoxx08 - Nuxeo Core, JCR 2, CMIS
Devoxx08 - Nuxeo Core, JCR 2, CMIS Devoxx08 - Nuxeo Core, JCR 2, CMIS
Devoxx08 - Nuxeo Core, JCR 2, CMIS
Nuxeo
 
Filesinc 130512002619-phpapp01
Filesinc 130512002619-phpapp01Filesinc 130512002619-phpapp01
Filesinc 130512002619-phpapp01
Rex Joe
 
Files in c++
Files in c++Files in c++
Files in c++
Selvin Josy Bai Somu
 
Object Oriented Programming using C++: Ch12 Streams and Files.pptx
Object Oriented Programming using C++: Ch12 Streams and Files.pptxObject Oriented Programming using C++: Ch12 Streams and Files.pptx
Object Oriented Programming using C++: Ch12 Streams and Files.pptx
RashidFaridChishti
 
Object Oriented Programming Using C++: Ch12 Streams and Files.pptx
Object Oriented Programming Using C++: Ch12 Streams and Files.pptxObject Oriented Programming Using C++: Ch12 Streams and Files.pptx
Object Oriented Programming Using C++: Ch12 Streams and Files.pptx
RashidFaridChishti
 

Similar to using System.docx (20)

Description 1) Create a Lab2 folder for this project2.docx
Description       1)  Create a Lab2 folder for this project2.docxDescription       1)  Create a Lab2 folder for this project2.docx
Description 1) Create a Lab2 folder for this project2.docx
 
ASP.NET Session 7
ASP.NET Session 7ASP.NET Session 7
ASP.NET Session 7
 
Create a text file named lnfo.txt. Enter the following informatio.pdf
Create a text file named lnfo.txt. Enter the following informatio.pdfCreate a text file named lnfo.txt. Enter the following informatio.pdf
Create a text file named lnfo.txt. Enter the following informatio.pdf
 
Java I/o streams
Java I/o streamsJava I/o streams
Java I/o streams
 
File handling
File handlingFile handling
File handling
 
File Handling in Java.pdf
File Handling in Java.pdfFile Handling in Java.pdf
File Handling in Java.pdf
 
Chapter 11
Chapter 11Chapter 11
Chapter 11
 
Whitepaper To Study Filestream Option In Sql Server
Whitepaper To Study Filestream Option In Sql ServerWhitepaper To Study Filestream Option In Sql Server
Whitepaper To Study Filestream Option In Sql Server
 
Unix lab
Unix labUnix lab
Unix lab
 
09.Local Database Files and Storage on WP
09.Local Database Files and Storage on WP09.Local Database Files and Storage on WP
09.Local Database Files and Storage on WP
 
Srgoc dotnet
Srgoc dotnetSrgoc dotnet
Srgoc dotnet
 
File Handling.pptx
File Handling.pptxFile Handling.pptx
File Handling.pptx
 
15. Streams Files and Directories
15. Streams Files and Directories 15. Streams Files and Directories
15. Streams Files and Directories
 
Java căn bản - Chapter12
Java căn bản - Chapter12Java căn bản - Chapter12
Java căn bản - Chapter12
 
Chapter 12 - File Input and Output
Chapter 12 - File Input and OutputChapter 12 - File Input and Output
Chapter 12 - File Input and Output
 
Devoxx08 - Nuxeo Core, JCR 2, CMIS
Devoxx08 - Nuxeo Core, JCR 2, CMIS Devoxx08 - Nuxeo Core, JCR 2, CMIS
Devoxx08 - Nuxeo Core, JCR 2, CMIS
 
Filesinc 130512002619-phpapp01
Filesinc 130512002619-phpapp01Filesinc 130512002619-phpapp01
Filesinc 130512002619-phpapp01
 
Files in c++
Files in c++Files in c++
Files in c++
 
Object Oriented Programming using C++: Ch12 Streams and Files.pptx
Object Oriented Programming using C++: Ch12 Streams and Files.pptxObject Oriented Programming using C++: Ch12 Streams and Files.pptx
Object Oriented Programming using C++: Ch12 Streams and Files.pptx
 
Object Oriented Programming Using C++: Ch12 Streams and Files.pptx
Object Oriented Programming Using C++: Ch12 Streams and Files.pptxObject Oriented Programming Using C++: Ch12 Streams and Files.pptx
Object Oriented Programming Using C++: Ch12 Streams and Files.pptx
 

Recently uploaded

Khushi Saini, An Intern from The Sparks Foundation
Khushi Saini, An Intern from The Sparks FoundationKhushi Saini, An Intern from The Sparks Foundation
Khushi Saini, An Intern from The Sparks Foundation
khushisaini0924
 
22. Certificate of Appreciation Deepika.
22. Certificate of Appreciation Deepika.22. Certificate of Appreciation Deepika.
22. Certificate of Appreciation Deepika.
Manu Mitra
 
23. Certificate of Appreciation Ramanji.
23. Certificate of Appreciation Ramanji.23. Certificate of Appreciation Ramanji.
23. Certificate of Appreciation Ramanji.
Manu Mitra
 
欧洲杯外围-欧洲杯外围下注网址-欧洲杯外围下注网站|【​网址​🎉ac44.net🎉​】
欧洲杯外围-欧洲杯外围下注网址-欧洲杯外围下注网站|【​网址​🎉ac44.net🎉​】欧洲杯外围-欧洲杯外围下注网址-欧洲杯外围下注网站|【​网址​🎉ac44.net🎉​】
欧洲杯外围-欧洲杯外围下注网址-欧洲杯外围下注网站|【​网址​🎉ac44.net🎉​】
landrielgabriel274
 
一比一原版坎特伯雷大学毕业证(UC毕业证书)学历如何办理
一比一原版坎特伯雷大学毕业证(UC毕业证书)学历如何办理一比一原版坎特伯雷大学毕业证(UC毕业证书)学历如何办理
一比一原版坎特伯雷大学毕业证(UC毕业证书)学历如何办理
cenaws
 
一比一原版(kcl毕业证书)英国金斯顿大学毕业证如何办理
一比一原版(kcl毕业证书)英国金斯顿大学毕业证如何办理一比一原版(kcl毕业证书)英国金斯顿大学毕业证如何办理
一比一原版(kcl毕业证书)英国金斯顿大学毕业证如何办理
zukou
 
0624.CV_studentscholarandacademic-02.pdf
0624.CV_studentscholarandacademic-02.pdf0624.CV_studentscholarandacademic-02.pdf
0624.CV_studentscholarandacademic-02.pdf
Thomas GIRARD BDes
 
欧洲杯足彩-欧洲杯足彩体育投注-欧洲杯足彩投注网站|【​网址​🎉ac99.net🎉​】
欧洲杯足彩-欧洲杯足彩体育投注-欧洲杯足彩投注网站|【​网址​🎉ac99.net🎉​】欧洲杯足彩-欧洲杯足彩体育投注-欧洲杯足彩投注网站|【​网址​🎉ac99.net🎉​】
欧洲杯足彩-欧洲杯足彩体育投注-欧洲杯足彩投注网站|【​网址​🎉ac99.net🎉​】
lemike859
 
欧洲杯外围-欧洲杯外围赛程-欧洲杯外围压注|【​网址​🎉ac99.net🎉​】
欧洲杯外围-欧洲杯外围赛程-欧洲杯外围压注|【​网址​🎉ac99.net🎉​】欧洲杯外围-欧洲杯外围赛程-欧洲杯外围压注|【​网址​🎉ac99.net🎉​】
欧洲杯外围-欧洲杯外围赛程-欧洲杯外围压注|【​网址​🎉ac99.net🎉​】
karimimorine448
 
World Productivity increases your efficiency
World Productivity increases your efficiencyWorld Productivity increases your efficiency
World Productivity increases your efficiency
joenofal1
 
一比一原版(dmu毕业证书)英国德蒙福特大学毕业证如何办理
一比一原版(dmu毕业证书)英国德蒙福特大学毕业证如何办理一比一原版(dmu毕业证书)英国德蒙福特大学毕业证如何办理
一比一原版(dmu毕业证书)英国德蒙福特大学毕业证如何办理
uhynup
 
美洲杯投注-美洲杯投注比分-美洲杯投注比分投注|【​网址​🎉ac44.net🎉​】
美洲杯投注-美洲杯投注比分-美洲杯投注比分投注|【​网址​🎉ac44.net🎉​】美洲杯投注-美洲杯投注比分-美洲杯投注比分投注|【​网址​🎉ac44.net🎉​】
美洲杯投注-美洲杯投注比分-美洲杯投注比分投注|【​网址​🎉ac44.net🎉​】
balliuvilla512
 
美洲杯买球-美洲杯买球下注平台-美洲杯买球投注平台|【​网址​🎉ac55.net🎉​】
美洲杯买球-美洲杯买球下注平台-美洲杯买球投注平台|【​网址​🎉ac55.net🎉​】美洲杯买球-美洲杯买球下注平台-美洲杯买球投注平台|【​网址​🎉ac55.net🎉​】
美洲杯买球-美洲杯买球下注平台-美洲杯买球投注平台|【​网址​🎉ac55.net🎉​】
ahmedendrise81
 
一比一原版(uwm毕业证书)美国威斯康星大学密尔沃基分校毕业证如何办理
一比一原版(uwm毕业证书)美国威斯康星大学密尔沃基分校毕业证如何办理一比一原版(uwm毕业证书)美国威斯康星大学密尔沃基分校毕业证如何办理
一比一原版(uwm毕业证书)美国威斯康星大学密尔沃基分校毕业证如何办理
aweuwyo
 
美洲杯体育投注-美洲杯体育投注推荐-美洲杯体育投注|【​网址​🎉ac10.net🎉​】
美洲杯体育投注-美洲杯体育投注推荐-美洲杯体育投注|【​网址​🎉ac10.net🎉​】美洲杯体育投注-美洲杯体育投注推荐-美洲杯体育投注|【​网址​🎉ac10.net🎉​】
美洲杯体育投注-美洲杯体育投注推荐-美洲杯体育投注|【​网址​🎉ac10.net🎉​】
hanniaarias53
 
欧洲杯买球-欧洲杯买球买球推荐-欧洲杯买球买球推荐网站|【​网址​🎉ac10.net🎉​】
欧洲杯买球-欧洲杯买球买球推荐-欧洲杯买球买球推荐网站|【​网址​🎉ac10.net🎉​】欧洲杯买球-欧洲杯买球买球推荐-欧洲杯买球买球推荐网站|【​网址​🎉ac10.net🎉​】
欧洲杯买球-欧洲杯买球买球推荐-欧洲杯买球买球推荐网站|【​网址​🎉ac10.net🎉​】
ahmedendrise81
 
一比一原版英国伦敦南岸大学毕业证(LSBU学位证)如何办理
一比一原版英国伦敦南岸大学毕业证(LSBU学位证)如何办理一比一原版英国伦敦南岸大学毕业证(LSBU学位证)如何办理
一比一原版英国伦敦南岸大学毕业证(LSBU学位证)如何办理
zqgk8x
 
一比一原版(surrey毕业证书)英国萨里大学毕业证成绩单修改如何办理
一比一原版(surrey毕业证书)英国萨里大学毕业证成绩单修改如何办理一比一原版(surrey毕业证书)英国萨里大学毕业证成绩单修改如何办理
一比一原版(surrey毕业证书)英国萨里大学毕业证成绩单修改如何办理
gnokue
 
一比一原版美国西北大学毕业证(NWU毕业证书)学历如何办理
一比一原版美国西北大学毕业证(NWU毕业证书)学历如何办理一比一原版美国西北大学毕业证(NWU毕业证书)学历如何办理
一比一原版美国西北大学毕业证(NWU毕业证书)学历如何办理
1wful2fm
 
Community Skills Building Workshop | PMI Silver Spring Chapter | June 12, 2024
Community Skills Building Workshop | PMI Silver Spring Chapter  | June 12, 2024Community Skills Building Workshop | PMI Silver Spring Chapter  | June 12, 2024
Community Skills Building Workshop | PMI Silver Spring Chapter | June 12, 2024
Hector Del Castillo, CPM, CPMM
 

Recently uploaded (20)

Khushi Saini, An Intern from The Sparks Foundation
Khushi Saini, An Intern from The Sparks FoundationKhushi Saini, An Intern from The Sparks Foundation
Khushi Saini, An Intern from The Sparks Foundation
 
22. Certificate of Appreciation Deepika.
22. Certificate of Appreciation Deepika.22. Certificate of Appreciation Deepika.
22. Certificate of Appreciation Deepika.
 
23. Certificate of Appreciation Ramanji.
23. Certificate of Appreciation Ramanji.23. Certificate of Appreciation Ramanji.
23. Certificate of Appreciation Ramanji.
 
欧洲杯外围-欧洲杯外围下注网址-欧洲杯外围下注网站|【​网址​🎉ac44.net🎉​】
欧洲杯外围-欧洲杯外围下注网址-欧洲杯外围下注网站|【​网址​🎉ac44.net🎉​】欧洲杯外围-欧洲杯外围下注网址-欧洲杯外围下注网站|【​网址​🎉ac44.net🎉​】
欧洲杯外围-欧洲杯外围下注网址-欧洲杯外围下注网站|【​网址​🎉ac44.net🎉​】
 
一比一原版坎特伯雷大学毕业证(UC毕业证书)学历如何办理
一比一原版坎特伯雷大学毕业证(UC毕业证书)学历如何办理一比一原版坎特伯雷大学毕业证(UC毕业证书)学历如何办理
一比一原版坎特伯雷大学毕业证(UC毕业证书)学历如何办理
 
一比一原版(kcl毕业证书)英国金斯顿大学毕业证如何办理
一比一原版(kcl毕业证书)英国金斯顿大学毕业证如何办理一比一原版(kcl毕业证书)英国金斯顿大学毕业证如何办理
一比一原版(kcl毕业证书)英国金斯顿大学毕业证如何办理
 
0624.CV_studentscholarandacademic-02.pdf
0624.CV_studentscholarandacademic-02.pdf0624.CV_studentscholarandacademic-02.pdf
0624.CV_studentscholarandacademic-02.pdf
 
欧洲杯足彩-欧洲杯足彩体育投注-欧洲杯足彩投注网站|【​网址​🎉ac99.net🎉​】
欧洲杯足彩-欧洲杯足彩体育投注-欧洲杯足彩投注网站|【​网址​🎉ac99.net🎉​】欧洲杯足彩-欧洲杯足彩体育投注-欧洲杯足彩投注网站|【​网址​🎉ac99.net🎉​】
欧洲杯足彩-欧洲杯足彩体育投注-欧洲杯足彩投注网站|【​网址​🎉ac99.net🎉​】
 
欧洲杯外围-欧洲杯外围赛程-欧洲杯外围压注|【​网址​🎉ac99.net🎉​】
欧洲杯外围-欧洲杯外围赛程-欧洲杯外围压注|【​网址​🎉ac99.net🎉​】欧洲杯外围-欧洲杯外围赛程-欧洲杯外围压注|【​网址​🎉ac99.net🎉​】
欧洲杯外围-欧洲杯外围赛程-欧洲杯外围压注|【​网址​🎉ac99.net🎉​】
 
World Productivity increases your efficiency
World Productivity increases your efficiencyWorld Productivity increases your efficiency
World Productivity increases your efficiency
 
一比一原版(dmu毕业证书)英国德蒙福特大学毕业证如何办理
一比一原版(dmu毕业证书)英国德蒙福特大学毕业证如何办理一比一原版(dmu毕业证书)英国德蒙福特大学毕业证如何办理
一比一原版(dmu毕业证书)英国德蒙福特大学毕业证如何办理
 
美洲杯投注-美洲杯投注比分-美洲杯投注比分投注|【​网址​🎉ac44.net🎉​】
美洲杯投注-美洲杯投注比分-美洲杯投注比分投注|【​网址​🎉ac44.net🎉​】美洲杯投注-美洲杯投注比分-美洲杯投注比分投注|【​网址​🎉ac44.net🎉​】
美洲杯投注-美洲杯投注比分-美洲杯投注比分投注|【​网址​🎉ac44.net🎉​】
 
美洲杯买球-美洲杯买球下注平台-美洲杯买球投注平台|【​网址​🎉ac55.net🎉​】
美洲杯买球-美洲杯买球下注平台-美洲杯买球投注平台|【​网址​🎉ac55.net🎉​】美洲杯买球-美洲杯买球下注平台-美洲杯买球投注平台|【​网址​🎉ac55.net🎉​】
美洲杯买球-美洲杯买球下注平台-美洲杯买球投注平台|【​网址​🎉ac55.net🎉​】
 
一比一原版(uwm毕业证书)美国威斯康星大学密尔沃基分校毕业证如何办理
一比一原版(uwm毕业证书)美国威斯康星大学密尔沃基分校毕业证如何办理一比一原版(uwm毕业证书)美国威斯康星大学密尔沃基分校毕业证如何办理
一比一原版(uwm毕业证书)美国威斯康星大学密尔沃基分校毕业证如何办理
 
美洲杯体育投注-美洲杯体育投注推荐-美洲杯体育投注|【​网址​🎉ac10.net🎉​】
美洲杯体育投注-美洲杯体育投注推荐-美洲杯体育投注|【​网址​🎉ac10.net🎉​】美洲杯体育投注-美洲杯体育投注推荐-美洲杯体育投注|【​网址​🎉ac10.net🎉​】
美洲杯体育投注-美洲杯体育投注推荐-美洲杯体育投注|【​网址​🎉ac10.net🎉​】
 
欧洲杯买球-欧洲杯买球买球推荐-欧洲杯买球买球推荐网站|【​网址​🎉ac10.net🎉​】
欧洲杯买球-欧洲杯买球买球推荐-欧洲杯买球买球推荐网站|【​网址​🎉ac10.net🎉​】欧洲杯买球-欧洲杯买球买球推荐-欧洲杯买球买球推荐网站|【​网址​🎉ac10.net🎉​】
欧洲杯买球-欧洲杯买球买球推荐-欧洲杯买球买球推荐网站|【​网址​🎉ac10.net🎉​】
 
一比一原版英国伦敦南岸大学毕业证(LSBU学位证)如何办理
一比一原版英国伦敦南岸大学毕业证(LSBU学位证)如何办理一比一原版英国伦敦南岸大学毕业证(LSBU学位证)如何办理
一比一原版英国伦敦南岸大学毕业证(LSBU学位证)如何办理
 
一比一原版(surrey毕业证书)英国萨里大学毕业证成绩单修改如何办理
一比一原版(surrey毕业证书)英国萨里大学毕业证成绩单修改如何办理一比一原版(surrey毕业证书)英国萨里大学毕业证成绩单修改如何办理
一比一原版(surrey毕业证书)英国萨里大学毕业证成绩单修改如何办理
 
一比一原版美国西北大学毕业证(NWU毕业证书)学历如何办理
一比一原版美国西北大学毕业证(NWU毕业证书)学历如何办理一比一原版美国西北大学毕业证(NWU毕业证书)学历如何办理
一比一原版美国西北大学毕业证(NWU毕业证书)学历如何办理
 
Community Skills Building Workshop | PMI Silver Spring Chapter | June 12, 2024
Community Skills Building Workshop | PMI Silver Spring Chapter  | June 12, 2024Community Skills Building Workshop | PMI Silver Spring Chapter  | June 12, 2024
Community Skills Building Workshop | PMI Silver Spring Chapter | June 12, 2024
 

using System.docx

  • 1. using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.IO; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { Console.WriteLine("Please enter a name for the new directory:"); string DirName = Console.ReadLine(); // Checking if string is empty or not if (DirName != String.Empty) { // Creating the Directory Directory.CreateDirectory("D:"+DirName); // Checking Directory is created // Successfully or not if (Directory.Exists(DirName)) { Console.WriteLine("The directory was created!"); Console.ReadKey(); } } } } } using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.IO; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { Console.WriteLine("Enter the directory name you want to delete:"); string DirName = Console.ReadLine(); if (Directory.Exists("D://"+DirName)) { Directory.Delete("D://"+DirName); if(Directory.Exists("D://"+DirName) == false) { Console.WriteLine("Directory deleted successfully..."); } } else { Console.WriteLine("Directory {0} does not exist!", DirName); Console.ReadLine(); } } } }
  • 2. C# - Stream C# includes following standard IO (Input/Output) classes to read/write from different sources like files, memory, network, isolated storage, etc. Stream: System.IO.Stream is an abstract class that provides standard methods to transfer bytes (read, write, etc.) to the source. It is like a wrapper class to transfer bytes. Classes that need to read/write bytes from a particular source must implement the Stream class. StreamReader: StreamReader is a helper class for reading characters from a Stream by converting bytes into characters using an encoded value. It can be used to read strings (characters) from different Streams like FileStream, MemoryStream, etc. StreamWriter: StreamWriter is a helper class for writing a string to a Stream by converting characters into bytes. It can be used to write strings to different Streams such as FileStream, MemoryStream, etc. using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.IO; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { //Create object of FileInfo for specified path FileInfo fi = new FileInfo(@"D:skcollegeDummyFile.txt"); //Open file for ReadWrite FileStream fs = fi.Open(FileMode.OpenOrCreate,FileAccess.Write, FileShare.Write); //Create StreamWriter object to write string to FileSream StreamWriter sw = new StreamWriter(fs); sw.WriteLine("line 1 from streamwriter"); sw.WriteLine("line 2 line from streamwriter"); sw.Close(); } } } >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.IO; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { FileInfo fi = new FileInfo(@"D:skcollegeDummyFile.txt"); FileStream fs = fi.Open(FileMode.Open, FileAccess.Read, FileShare.Read);
  • 3. StreamReader sr = new StreamReader(fs); string fileContent = sr.ReadToEnd(); Console.WriteLine(fileContent); sr.Close(); fs.Close(); Console.ReadLine(); // Line by Line Reading 1.// Write file contents on console. 2. using (StreamReader sr = File.OpenText(fileName)) 3. { 4. string s = ""; 5. while ((s = sr.ReadLine()) != null) 6. { 7. Console.WriteLine(s); 8. } 9. } } } } >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> The BinaryReader and BinaryWriter classes are used for reading from and writing to a binary file. The BinaryReader and BinaryWriter classes are used for reading from and writing to a binary file.