CSCI 3328 Object Oriented Programming in C# Chapter 11: Files and Streams -- Exercises 1 Xiang Lian The University of Texas Rio Grande Valley Edinburg,

Slides:



Advertisements
Similar presentations
© Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Outline 24.1 Test-Driving the Ticket Information Application.
Advertisements

Pemrograman VisualMinggu …12… Page 1 MINGGU Ke Duabelas Pemrograman Visual Pokok Bahasan: File and Stream Tujuan Instruksional Khusus: Mahasiswa dapat.
C# - Files and Streams Outline Files and Streams Classes File and Directory Creating a Sequential-Access File Reading Data from a Sequential-Access.
Files & Streams. Files Introduction Files are used for long-term retention of large amounts of data, even after the program that created the data terminates.
Object-Oriented Application Development Using VB.NET 1 Chapter 13 Introduction to Data Access Classes and Persistence.
File Systems Files and directories Absolute and relative names Text and binary files Sequential-access and random-access files.
MIS316 – BUSINESS APPLICATION DEVELOPMENT – Chapter 14 – Files and Streams 1Microsoft Visual C# 2012, Fifth Edition.
1 Binary Files ผศ. ดร. หมัดอามีน หมันหลิน Faculty of IST, MUT
CIS 200 Final Review. New Material Data Structures.
CSCI 3328 Object Oriented Programming in C# Chapter 2: Introduction to Visual C# Programming 1 Xiang Lian The University of Texas Rio Grande Valley Edinburg,
CIS 200 Test 02 Review. Windows Forms, GUI Programming  Elements  Textboxes  Tab Groups  Checkboxes  Fields  Event Handlers  Visual Studio Designer.
 2006 Pearson Education, Inc. All rights reserved Files and Streams.
1 14/10/58Dr.Mud-Armeen Munlin 1 Files and Streams ผศ. ดร. หมัดอามีน หมันหลิน Faculty of IST, MUT
Chapter Ten Structures and Sequential Access Files Programming with Microsoft Visual Basic th Edition.
T U T O R I A L  2009 Pearson Education, Inc. All rights reserved Ticket Information Application Introducing Sequential-Access Files.
Chapter Ten Structures and Sequential Access Files Programming with Microsoft Visual Basic th Edition.
Reference: Lecturer Lecturer Reham O. Al-Abdul Jabba lectures for cap211 Files and Streams- I.
CSCI 3327 Visual Basic Chapter 13: Databases and LINQ UTPA – Fall 2011.
CSCI 3328 Object Oriented Programming in C# Chapter 5: C# Control Statement – Part II – Exercises 1 Xiang Lian The University of Texas Rio Grande Valley.
Files and Streams. Objectives Learn about the classes that support file input/output Understand the concept of abstraction and how it related to the file.
Visual Basic 2010 How to Program © by Pearson Education, Inc. All Rights Reserved.
CSCI 3328 Object Oriented Programming in C# Chapter 8: LINQ and Generic Collections 1 Xiang Lian The University of Texas Rio Grande Valley Edinburg, TX.
Chapter 14: Files and Streams. 2Microsoft Visual C# 2012, Fifth Edition Files and the File and Directory Classes Temporary storage – Usually called computer.
CSCI 4333 Database Design and Implementation – Exercise (5) Xiang Lian The University of Texas – Pan American Edinburg, TX
CSCI 3328 Object Oriented Programming in C# Chapter 9: Classes and Objects: A Deeper Look – Exercises 1 Xiang Lian The University of Texas Rio Grande Valley.
Programming with Microsoft Visual Basic 2008 Fourth Edition Chapter Ten Structures and Sequential Access Files.
CSCI 3328 Object Oriented Programming in C# Chapter 8: LINQ and Generic Collections – Exercises 1 Xiang Lian The University of Texas – Pan American Edinburg,
CSCI 3328 Object Oriented Programming in C# Chapter 12: Databases and LINQ – Exercises 1 Xiang Lian The University of Texas Rio Grande Valley Edinburg,
CSCI 4333 Database Design and Implementation – Exercise (2) Xiang Lian The University of Texas Rio Grande Valley Edinburg, TX 78539
CSCI 4333 Database Design and Implementation – Exercise (1) Xiang Lian The University of Texas Rio Grande Valley Edinburg, TX 78539
CSCI 3328 Object Oriented Programming in C# Chapter 11: Files and Streams 1 Xiang Lian The University of Texas Rio Grande Valley Edinburg, TX 78539
CSCI 3328 Object Oriented Programming in C# Chapter 6: Methods – Exercises 1 Xiang Lian The University of Texas Rio Grande Valley Edinburg, TX 78539
CSCI 3328 Object Oriented Programming in C# Chapter 4: C# Control Statement – Part I – Exercises 1 Xiang Lian The University of Texas Rio Grande Valley.
CSCI/CMPE 4341 Topic: Programming in Python Chapter 7: Introduction to Object- Oriented Programming in Python – Exercises Xiang Lian The University of.
Files and Streams Lec Introduction  Files are used for long-term retention of large amounts of data, even after the program that created the.
CSCI 4333 Database Design and Implementation – Exercise (5)
CIS 200 Test 02 Review.
CSCI 3327 Visual Basic Chapter 11: Files and Streams
Files.
18 Files and Streams.
CSCI 3327 Visual Basic Chapter 11: Files and Streams
CSCI 3328 Object Oriented Programming in C# Review: Final Exam
The University of Texas – Pan American
Sequential Input and Output using Text Files
File Input/Output (I/O)
CSCI 6315 Applied Database Systems – Exercise (3)
The University of Texas – Pan American
CSCI 3327 Visual Basic Chapter 8: Introduction to LINQ and Collections
CSCI 3328 Object Oriented Programming in C# Review: Exam I
Files & Streams.
The University of Texas – Pan American
CSCI 3327 Visual Basic Review: Final Exam
CSCI 3328 Object Oriented Programming in C# Review: Exam I
The University of Texas Rio Grande Valley
CSCI 4333 Database Design and Implementation – Exercise (5)
CSCI 3328 Object Oriented Programming in C# Review: Final Exam
CSCI 3328 Object Oriented Programming in C# Chapter 11: Files and Streams -- Exercises UTPA – Fall 2012 This set of slides is revised from lecture slides.
The University of Texas – Pan American
CSCI 6307 Foundation of Systems – Exercise (1)
CSCI 3327 Visual Basic Review: Exam I
CSCI 3328 Object Oriented Programming in C# Review: Exam II
CSCI 3328 Object Oriented Programming in C# Review: Final Exam
The University of Texas – Pan American
CSCI 6315 Applied Database Systems – Exercise (6)
Files and Streams Lect10 GC201 12/1/2015.
CSCI 3328 Object Oriented Programming in C# Review: Final Exam
CIS16 Application Development and Programming using Visual Basic.net
CSCI 3328 Object Oriented Programming in C# Chapter 11: Files and Streams UTPA – Fall 2012 This set of slides is revised from lecture slides of Prof.
The University of Texas – Pan American
Chapter 11 Saving Data and Objects In Files
Presentation transcript:

CSCI 3328 Object Oriented Programming in C# Chapter 11: Files and Streams -- Exercises 1 Xiang Lian The University of Texas Rio Grande Valley Edinburg, TX

Objectives In this chapter, you will do some exercises about: –Windows GUI –Classes File and Directory –LINQ queries to search through directories –sequential-access file processing –Classes FileStream, StreamReader, StreamWriter, FileStream, and BinaryFormatter 2

Multiple Choices The smallest data item a computer can process is called a ________. –A. database B. byte C. file D. bit A group of related records is stored in a ____. –A. file B. field C. bit D. byte Data maintained in a file is called _____. –A. persistent data B. bits C. secondary data D. databases Methods from the ____ class can be used to write data to a file. –A. StreamReader B. WriteFile C. StreamWriter D. None of the above Namespace ____ provides the classes and methods you need to perform file processing. –A. System.IO B. System.Files C. System.Stream D. System.Windows.Forms A(n) ____ allows the user to select a file to open. –A. CreateFileDialog B. OpenFileDialog C. MessageBox D. SaveFileDialog 3

Multiple Choices (cont'd) StreamReader method _____ reads a line from a file. –A. ReadLine B. Read C. ReadAll D. ReadToNewline A _____contains information that is read in the order it was written. –A. sequential-access file B. StreamWriter C. StreamReader D. None of the above Methods from class _____ can be used to read data from a file. –A. StreamWriter B. FileReader C. StreamReader D. None of the above Ultimately, all data items processed by a computer are reduced to combinations of _________. –A. 0-9 B. 'a'-'z' C. 'A'-'Z' D. 0's and 1's Method Serialize of class BinaryFormatter takes a(n) _______ and a(n) __________ as arguments. –A. object and Stream B. Stream and object C. File and object D. object and File 4

True / False Statement Creating instances of classes File and Directory is impossible. Typically, a sequential file stores records in order by the record-key fields. Class StreamReader inherits from class Stream. Any class can be serialized to a file. Classes StreamReader and StreamWriter are used with sequential-access files. The class BinaryFormatter is under the namespace System.Runtime.Serialization.Formatters.Binary. 5

True / False Statement (cont'd) The ListBox control allows only a single selection (like a RadioButton). Controls such as form, GroupBox, Panel, and TabControl are all containers. All mouse events use the same event arguments class. A ComboBox control typically has a drop-down list. Deleting a parent node in a TreeView control deletes its child nodes. 6

Writing the C# Code A student record has information such as student ID, last name, first name, birth year, and so on. –Declare a class for a student record –Write a method to write records into a file, using StreamWriter –Write a method to read records from a file into a record array, using StreamReader –Use an LINQ query to find those students with the birth year > 1981, and write them into another file using BinaryFormatter 7

8