Presentation is loading. Please wait.

Presentation is loading. Please wait.

Understanding Input/Output (I/O) Classes Lesson 5.

Similar presentations


Presentation on theme: "Understanding Input/Output (I/O) Classes Lesson 5."— Presentation transcript:

1 Understanding Input/Output (I/O) Classes Lesson 5

2 Objective Domain Matrix Skills/ConceptsMTA Exam Objectives Understanding console I/O Understand Console I/O (4.2) Understanding.NET File Classes Understand.NET File Classes (4.1) Understanding XML Classes in the.NET Framework Understand XML Classes in the.NET Framework (4.3)

3 Console Input/Output Console applications do not have a graphical user interface and use a text-mode console window to interact with the user. Console applications read from standard input stream. Console applications write to standard output stream. Console applications can receive input via command-line parameters.

4 The Console Class Provides methods for reading data from and writing data to the console window.

5 Console Methods in Action

6 Command-line Arguments The command-line arguments are the values passed to the Main method from the operating system. The Main method receives the command-line arguments as a string array.

7 Demonstration – Console Application

8 Manipulating Disk Files and Directories The File manipulation (example: copy, move, delete ) classes are part of the System.IO namespace The File and the FileInfo classes manipulate disk files. The Directory and DirectoryInfo classes manipulate directories and sub-directories. The File and the Directory classes contains only static methods. The FileInfo and the DirectoryInfo classes contain the instance methods.

9 File Input and Output The classes for file-based input and output are part of the System.IO namespace. Text files are the data files that contain only character-based data. The StreamReader and the StreamWriter classes manipulate text files. Binary files store any type of data as a sequence of bytes. The BinaryReader and the BinaryWriter classes manipulate binary files.

10 Text Files A text file is a disk file that stores only character- based data. Character encoding describes the rules by which each character is represented. There are different encoding schemes available, such as ASCIIEncoding, UTF8Encoding, and UnicodeEncoding. By using UTF8Encoding and UnicodeEncoding, you can represent characters from all the international languages.

11 Writing Text Files

12 Reading Text Files

13 Writing Binary Files

14 Reading Binary Files

15 XML XML (Extensible Markup Language) is a text-based format for representing structured data.

16 Working with XML The classes to work with XML data are organized in the System.Xml namespace. The XmlReader and XmlWriter classes provide methods to respectively read data from and write data to XML files. The XmlReader and XmlWriter classes provide a fast, non-cached, and forward-only way to read or write XML data.

17 Writing XML File

18 Reading XML File

19 XML Schema XML schema describes the structure of an XML document. An XML document is considered valid only when it conforms to its XML schema. XML schema is particularly important when an XML file is used to share data between two applications. Without XML schema, the applications won’t know how the data in an XML file is structured.

20 Recap Console Input/Ouput The Console class Console methods Command-line arguments Manipulating disk files and directories File input and output Text files Binary files XML Reading and writing XML XML Schema


Download ppt "Understanding Input/Output (I/O) Classes Lesson 5."

Similar presentations


Ads by Google