0 évaluation0% ont trouvé ce document utile (0 vote)
45 vues10 pages
In.NET, a type is defined by a class, and the individual instances of that class are known as objects. A method (sometimes called a function) is a contained set of operations that are owned by the class. The static keyword indicates that you can invoke Main( ) without first creating an object.
In.NET, a type is defined by a class, and the individual instances of that class are known as objects. A method (sometimes called a function) is a contained set of operations that are owned by the class. The static keyword indicates that you can invoke Main( ) without first creating an object.
Droits d'auteur :
Attribution Non-Commercial (BY-NC)
Formats disponibles
Téléchargez comme TXT, PDF, TXT ou lisez en ligne sur Scribd
In.NET, a type is defined by a class, and the individual instances of that class are known as objects. A method (sometimes called a function) is a contained set of operations that are owned by the class. The static keyword indicates that you can invoke Main( ) without first creating an object.
Droits d'auteur :
Attribution Non-Commercial (BY-NC)
Formats disponibles
Téléchargez comme TXT, PDF, TXT ou lisez en ligne sur Scribd
1)In .NET, an assembly is the basic unit of reuse, versioning, security,and deployment.
2)As in many object-oriented programming languages, in C#, a type is defined by a
class, and the individual instances of that class are known as objects 3)A method (sometimes called a function) is a contained set of operations that are owned by the class. The member methods define what the class can do or how it behaves. 4)The CLR calls Main( ) when your program starts. Main( ) is the entry point for your program, and every C# program must have a Main( ) method 5)the dot operator (.) is used to access a method (and data) in a class (in this case, the method WriteLine( )), and to restrict the class name to a specific namespace (in this case, to locate Console within the System namespace). 6)The goal of namespaces is to help you divide and conquer the complexity of your object hi 7)The static keyword indicates that you can invoke Main( ) without first creating an object 8)Type----------- Size (in bytes)-----.NET type Description Byte------------- 1 Byte -------------Unsigned (values 0 to 255) Char------------- 2 Char -------------Unicode characters Bool ------------ 1 Boolean-----------True or false Sbyte------------ 1 SByte ------------Signed values ( 128 to 127) Short------------ 2 Int16 ------------Signed short values ( 32,768 to 32,767) Ushort----------- 2 UInt16------------Unsigned short values (0 to 65,535) Int-------------- 4 Int32-------------Signed integer values between 2,147,483,648 and 2,14 Uint------------- 4 UInt32 -----------Unsigned integer values between 0 and 4,294,967,295 Float------------ 4 Single -----------Floating-point number. Holds values from approximatel Double----------- 8 Double -----------Double-precision floating-point. Holds values from ap decimal---------- 16 Decimal ---------Fixed-precision value up to 28 digits and the positio Long -------------8--Int64 -----------Signed integers from 9,223,372,036,854,775,808 to 9, Ulong ------------8 -UInt64 ----------Unsigned integers ranging from 0 to 0xfffffffffffffff In addition to these primitive types, C# has two other value types: enum and struct 9)A stack is a data structure used to store items on a last-in first-out basis (like a stac dishes at the buffet line in a restaurant). The stack refers to an area of memory managed by the processor, on which the local variables are stored. 10)The heap is an initially undifferentiated area of memory that can be referred to by item placed on the stack. 11)You must initialize a constant when you declare it, and once initialized, it can t be altered. For example: const int FreezingPoint = 32; 12)An enumeration is a distinct value type, consisting of a set of named constants (called enum ServingSizes :uint { Small = 1, Regular = 2, } 13)A string object holds a series of characters. 14)switch (expression) { case constant-expression: statement jump-statement [default: statement] } Iterations 15) while (expression) statement 16)do statement while (expression 17for ([initializers]; [expression]; [iterators]) statement 18)The foreach statement is used for looping through the elements of an array or a collecti 19)The continue and break statements There are times when you would like to return to the top of a loop without executing the re skip the remaining steps in the loop. The other side of that coin is the ability to break out of a loop and immediately end all further work within the loop. For this purpose, the break statement exists. 20)The Ternary Operator conditional-expression ? expression1 : expression2 21)Access modifier Restrictions public--------------- No restrictions. Members marked public are visible to any method of a private-------------- The members in class A that are marked private are accessible only to protected-------------The members in class A that are marked protected are accessible to me internal------------- The members in class A that are marked internal are accessible to met protected internal----The members in class A that are marked protected internal are accessi protected OR internal. (There is no concept of protected AND internal.) 22)The job of a constructor is to create the object specified by a class and to put it into the object is undifferentiated memory; after the constructor completes, the memory holds a 23)The .NET Framework defines an ICloneable interface to support the concept of a copy cons 24)The keyword this refers to the current instance of an object 25)In C#, it is not legal to access a static method or member variable through an instance, 26)Mark your class Static to ensure that no instance of the class may be created. Static cl however, that static classes may not contain nonstatic members or have a constructor 27)How Destructors Work The garbage collector maintains a list of objects that have a destructor. This list is updated every time such an object is created or destroyed. When an object on this list is first collected, it is placed in a queue with other objects waiting to be destroyed. After the destructor executes, the garbage collector collects the object and updates the queue, as well as its list of destructible objects. 28)If you provide a Dispose( ) method, you should stop the garbage collector from calling your object s destructor. To do so, call the static method GC.SuppressFinalize( ), passing in the this pointer for your object. Your destructor can then call your Dispose( ) method. 29)Keep in mind that ref parameters are references to the actual original value: it is as though you said, Here, work on this one. Conversely, value parameters are copies: it is as though you said, Here, work on one just like this. 30)C# imposes definite assignment, which requires that all variables be assigned a value before they are used.C# provides the out parameter modifier for this situation. The out mod the requirement that a reference parameter be initialized. 31)To summarize, value types are passed into methods by value. ref parameters are used to pass value types into a method by reference. This allows you to retrieve their modified values in the calling method. out parameters are used only to return information from a method. 32)overloaded methods or constructors have sane name but different signatures or different type doesn t overload the method, and creating two methods with the same signature but dif 33)get set methods--------The two main advantages of this approach are that the client can properties directly, without sacrificing the data-hiding and encapsulation sacrosanct in good object-oriented design, and that the author of the property can ensure that the data provided is valid. 34)The derived class inherits all the members of the base class, both member variables and 35)polymorphism refers to being able to use many forms of a type without regard to the deta its base class.by using the keyword override in the derived class method definition, and th 36)Because classes can t inherit constructors, a derived class must implement its own const explicitly. public ListBox( int theTop, int theLeft, string theContents): base(theTop, theLeft) // call base constructor 37)Abstract classes establish a base for derived classes, but it is not legal to instantiat an object of an abstract class. Once you declare a method to be abstract, you prohibit the creation of any instances of that class. 38)If the derived class failed to implement the abstract method, that class would also be a instances would be possible. 39)a sealed class doesn t allow classes to derive from it at all. Placed before the class d the sealed keyword precludes derivation. Classes are most often marked sealed to prevent ac 40)In C#, the root class is Object. The methods of Object Equals( )---------------- Evaluates whether two objects are equivalent GetHashCode( )----------- Allows objects to provide their own hash function for use in coll GetType( )--------------- Provides access to the type object ToString( )---------------Provides a string representation of the object Finalize( )---------------Cleans up unmanaged resources; implemented by a destructor (see C MemberwiseClone( )------- Creates copies of the object; should never be implemented by your ReferenceEquals( )------- Evaluates whether two objects refer to the same instance 41)A struct is a simple user-defined type, a lightweight alternative to a class. Structs ar similar to classes in that they may contain constructors, properties, methods, fields, operators, nested types, and indexers .There are also significant differences between class structs don t support inheritance or destructors. More important, although a class is a reference type, a struct is a value type. (See Chapter 3 for more information about classes and types.) Thus, structs are useful for representing objects that don t require reference semantics. No destructor or custom default constructor in struct ,No initialization possible instruct 42)When you define an interface, you may define methods, properties, indexers, and events t 43)An array is an indexed collection of objects, all of the same type.For example: int[] myIntArray; 44)The params keyword allows you to pass in a variable number of parameters without necessa explicitly creating the array 45)An indexer is a C# construct that allows you to access collections contained by a class using the familiar [] syntax of arrays. An indexer is a special kind of property, and includes get and set accessors to specify its behavior. public string this[int index] { get { if (index < 0 || index >= strings.Length) {} return strings[index]; } set { // add only through the add method if (index >= ctr) { // handle error } else strings[index] = value; } } 46)Collection Interface ICollection<T>---------------- Base interface for generic collections IEnumerator<T> IEnumerable<T>----------------Enumerate through a collection using a foreach statement ICollection<T>--------------- Implemented by all collections to provide the CopyTo( ) metho IComparer<T> IComparable<T>----------------Compare two objects held in a collection so that the collecti IList<T> ---------------------Used by array-indexable collections IDictionary<K,V> -------------Used for key-/value-based collections such as Dictionary 47)The List class is an array whose size is dynamically increased as required Capacity------------------- Property to get or set the number of elements the List can cont if count exceeds capacity; you might set this value to reduce t Trim( ) to reduce this value to the actual Count Count---------------------- Property to get the number of elements currently in the array Item( ) --------------------Gets or sets the element at the specified index; this is the in Add( ) ---------------------Public method to add an object to the List AddRange( )---------------- Public method that adds the elements of an ICollection to the e AsReadOnly( )-------------- Public method that returns a read-only instance of the current BinarySearch( )------------ Overloaded public method that uses a binary search to locate a Clear( )------------------ Removes all elements from the List Contains( )--------------- Determines whether an element is in the List ConvertAll( )-------------- Public method that converts all elements in the current list in CopyTo( )------------------ Overloaded public method that copies a List to a one-dimensiona Exists( )------------------ Determines whether an element is in the List Find( ) ------------------- Returns the first occurrence of the element in the List FindAll( ) ---------------- Returns all the specified elements in the List FindIndex( ) -------------- Overloaded public method that returns the index of the first el FindLast( )--------------- Public method that finds the last element that matches a condit FindLastIndex( )----------- Overloaded public method that returns the index of the last ele ForEach( )----------------- Public static method that performs an action on all elements of GetEnumerator( )----------- Overloaded public method that returns an enumerator to iterate GetRange( )---------------- Copies a range of elements to a new List IndexOf( )----------------- Overloaded public method that returns the index of the first oc Insert( )------------------ Inserts an element into the List InsertRange( )------------- Inserts the elements of a collection into the List LastIndexOf( )------------- Overloaded public method that returns the index of the last occ Remove( )------------------ Removes the first occurrence of a specific object RemoveAll( )--------------- Removes all elements that match a specific condition RemoveAt( )---------------- Removes the element at the specified index RemoveRange( )------------- Removes a range of elements Reverse( )----------------- Reverses the order of elements in the List Sort( )-------------------- Sorts the List ToArray( )----------------- Copies the elements of the List to a new array TrimExcess( )-------------- Reduce the current list s capacity to the actual number of elem TrimToSize( )-------------- Sets the capacity of the actual number of elements in the List
48)A queue represents a first-in, first-out (FIFO) collection
Count Public property that gets the number of elements in the Queue Clear( ) -----------------Removes all objects from the Queue Contains( ) --------------Determines whether an element is in the Queue CopyTo( )---------------- Copies the Queue elements to an existing one-dimensional array Dequeue( ) ---------------Removes and returns the object at the beginning of the Queue Enqueue( ) ---------------Adds an object to the end of the Queue GetEnumerator( ) ---------Returns an enumerator for the Queue Peek( )------------------ Returns the object at the beginning of the Queue without removing ToArray( )--------------- Copies the elements to a new array TrimExcess( ) ------------Reduces the current queue s capacity to the actual number of elem 49)A stack is a last-in, first-out (LIFO) collection, like a stack of dishes at a buffet ta Count----------------------- Public property that gets the number of elements in the Stack Clear( )-------------------- Removes all objects from the Stack Contains( )----------------- Determines whether an element is in the Stack CopyTo( )------------------- Copies the Stack elements to an existing one-dimensional array GetEnumerator( ) ------------Returns an enumerator for the Stack Peek( )--------------------- Returns the object at the top of the Stack without removing it Pop( ) --------------------- Removes and returns the object at the top of the Stack Push( )--------------------- Inserts an object at the top of the Stack ToArray( )------------------ Copies the elements to a new array TrimExcess( )--------------- If the number of elements in the current stack is less than 90 reduces the current stack s capacity to the actual number of e 50)A dictionary is a collection that associates a key to a value. Count-------------------------- Public property that gets the number of elements in the Dic Item( ) ------------------------The indexer for the Dictionary Keys--------------------------- Public property that gets a collection containing the keys Values Public property that gets a collection containing th Add( )------------------------- Adds an entry with a specified Key and Value Clear( )------------------------Removes all objects from the Dictionary ContainsKey( )----------------- Determines whether the Dictionary has a specified key ContainsValue( ) ---------------Determines whether the Dictionary has a specified value GetEnumerator( )--------------- Returns an enumerator for the Dictionary GetObjectData( ) ---------------Implements ISerializable and returns the data needed to ser Remove( )---------------------- Removes the entry with the specified Key TryGetValue( )----------------- Gets the Value associated with the specified Key; if the Ke Dictionaries implement the IDictionary<K,V> interface (where K is the key type, and V is the value type). 51)Strings can also be created using verbatim string literals Thus, the following two definitions are equivalent: string literalOne = "\\\\MySystem\\MyDirectory\\ProgrammingC#.cs"; string verbatimLiteralOne = @"\\MySystem\MyDirectory\ProgrammingC#.cs"; 52)Another common way to create a string is to call the ToString( ) method on an object and assign the result to a string variable 53)Method or field Purpose Chars The string indexer Compare( ) -------------------Overloaded public static method that compares two strings CompareTo( )------------------Compares this string with another Concat( )-------------------- Overloaded public static method that creates a new string fro Copy( ) ----------------------Public static method that creates a new string by copying ano CopyTo( )--------------------- Copies the specified number of characters to an array of Uni EndsWith( )-------------------- Indicates whether the specified string matches the end of t Equals( )------------------------ Overloaded public static and instance method that determi Format( )----------------------- Overloaded public static method that formats a string usin Join( )--------------------------Overloaded public static method that concatenates a specif Length---------------------------- The number of characters in the instance Split( )---------------------------- Returns the substrings delimited by the specified char StartsWith( )------------------------- Indicates whether the string starts with the specifi Substring( )-------------------------- Retrieves a substring ToUpper( )----------------------------------------- Returns a copy of the string in upperca Trim( ) -----------------------------------------Removes all occurrences of a set of specif TrimEnd( )------------------------------------- Behaves like Trim( ), but only at the end 54)The System.Text.StringBuilder class is used for creating and modifying strings. Unlike String, StringBuilder is mutable. Example 10-4 replaces the String object in Chars---------- The indexer Length---------- Retrieves or assigns the length of the StringBuilder Append( ) -------Overloaded public method that appends a string of characters to the end of AppendFormat( )- Overloaded public method that replaces format specifiers with the formatte Insert( )------- Overloaded public method that inserts a string of characters at the specif Remove( )------- Removes the specified characters Replace( )------ Overloaded public method that replaces all instances of specified characte 55)A regular expression consists of two types of characters: literals and metacharacters. A literal is a character you wish to match in the target string. A metacharacter is a special symbol that acts as a command to the regular expression parser. The parser is the engine responsible for understanding the regular expression. The namespace System.Text.RegularExpressions is the home to all the .NET Framework objects associated with regular expressions.The central class for regular expression support is Regex, which represents an immutable, compiled regular expression. Although instances of Regex can be created, the class also provides a number of useful static method 56)It is important to distinguish between bugs, errors, and exceptions. A bug is a programm mistake that should be fixed before the code is shipped. Exceptions aren t a protection against bugs. Although a bug might cause an exception to be thrown, you should not rely on exceptions to handle your bugs. Rather, you should fix the bugs. An error is caused by user action. For example, the user might enter a number where a letter is expected. Once again, an error might cause an exception, but you can prevent that by catching errors with validation code. Whenever possible, errors should be anticipated and prevented. Even if you remove all bugs and anticipate all user errors, you will still run into predict but unpreventable problems, such as running out of memory or attempting to open a file that no longer exists. You can t prevent exceptions, 57) unwinding the stack refers to the process of finding the return address of the calling method and returning to that method peremptorily, looking for a catch block to handle the exception. The stack may have to unwind through a number of called methods before it finds a handler. Ultimately, if it unwinds all the way to main and no handler is found, a default handler is called, and the program exits. 58)The throw Statement To signal an abnormal condition in a C# class, you throw an exception. To do this, use the keyword throw. This line of code creates a new instance of System.Exception and then throws it: throw new System.Exception( ); Throwing an exception immediately halts execution of the current thread while the CLR se If an exception handler can t be found in the current method, the runtime unwinds the stack If the runtime returns all the way through Main( ) without finding a handler, it terminates the program 59)In C#, an exception handler is called a catch block and is created with the catch keyword. 60)The code in the finally block is guaranteed to be executed regardless of whether an exception is thrown 61)The StackTrace property of the exception can provide a stack trace for the error statement. A stack trace displays the call stack: the series of method calls that lead to the method in which the exception was thrown. 62)In the output, the stack trace lists the methods in the reverse order in which they were called; that is, it shows that the error occurred in DoDivide( ), which was called by TestFunc( ). When methods are deeply nested, the stack trace can help you understand the order of method calls. 61)Technically, a delegate is a reference type used to encapsulate a method with a specific signature and return type.* You can encapsulate any matching method in that delegate. 62)C# offers anonymous methods that allow you to pass a code block rather than the name of the method. This can make for more efficient and easier-to-maintain code, and the anonymous method has access to the variables in the scope in which they are defined: 63)In ADO.NET, the functionality that was in Record Sets now resides in two places. Navigation and retrieval are in the IDataReader interface, and support for disconnected operation is in the (tremendously more powerful) DataSet and DataTables. 64)The DataSet represents a subset of the entire database, cached on your machine without a continuous connection to the database.Periodically, you ll reconnect the DataSet to its parent database, update the with changes you ve made to the DataSet, and update the DataSet with changes in the database made by other processes 65)The DataSet is composed of DataTable objects as well as DataRelation objects. These are accessed as properties of the DataSet object. The Tables property returns a DataTableCollection, which in turn contains all the DataTable objects. 66)ADO.NET uses a DataAdapter as a bridge between the DataSet and the data source, which is the underlying database. DataAdapter provides the Fill( ) method to retrieve data from the database and populate the DataSet. 67)The DBConnection object represents a connection to a data source. This connection can be shared among different command objects. The DBCommand object allows you to send a command (typically, a SQL statement or a stored procedure) to the database. 68)The DataReader provides connected, forward-only, read-only access to a collection of tables by executing either a SQL statement or stored procedures. DataReaders are lightweight objects that are ideally suited for filling controls with data and then breaking the connection to the backend database. 69)SqlDataAdapter DataAdapter = new SqlDataAdapter( commandString, connectionString); DataSet DataSet = new DataSet( ); DataAdapter.Fill(DataSet,"Customers"); DataTable dataTable = DataSet.Tables[0]; foreach (DataRow dataRow in dataTable.Rows) { lbCustomers.Items.Add( dataRow["CompanyName"] + " (" + dataRow["ContactName"] + ")" ); } 70)Metadata is information about the data that is, information about the types, code, assembly, and so forth stored along with your program 71)Attributes are a mechanism for adding metadata, such as compiler instructions and other data about your data, methods, and classes to the program itself. Attributes are inserted into the metadata and are visible through ILDASM and other metadatareading tools. 72)Reflection is the process by which a program can read its own metadata, or metadata from another program. A program is said to reflect on itself or on another program, extracting metadata from the reflected assembly and using that metadata either to inform the user or to modify the program s behavior. 73)An attribute is an object that represents data you want to associate with an element in your program 74)Files and Directories The classes you need are in the System.IO namespace 75)Principal methods of the Directory class Method Use CreateDirectory( ) Creates all directories and subdirectories specified by its path paramet GetCreationTime( ) Returns and sets the time the specified directory was created GetDirectories( ) Gets named directories GetLogicalDrives( ) Returns the names of all the logical drives in the form <drive>:\ GetFiles( ) Returns the names of files matching a pattern GetParent( ) Returns the parent directory for the specified path Move( ) Moves a directory and its contents to a specified path 76)Principal methods and properties of the DirectoryInfo class Method or property Use Attributes ----------------Inherits from FileSystemInfo; gets or sets the attributes of the CreationTime-------------- Inherits from FileSystemInfo; gets or sets the creation time of Exists-------------------- Public property Boolean value, which is true if the directory ex Extension----------------- Public property inherited from FileSystemInfo; that is, the file FullName ------------------ Public property inherited from FileSystemInfo; that is, the ful LastAccessTime------------- Public property inherited from FileSystemInfo; gets or sets the LastWriteTime-------------- Public property inherited from FileSystemInfo; gets or sets the Name----------------------- Public property name of this instance of DirectoryInfo Parent--------------------- Public property parent directory of the specified directory Root----------------------- Public property root portion of the path Create( )------------------ Public method that creates a directory CreateSubdirectory( )------ Public method that creates a subdirectory on the specified path Delete( ) ------------------Public method that deletes a DirectoryInfo and its contents fro GetDirectories( )---------- Public method that returns a DirectoryInfo array with subdirect GetFiles( ) ----------------Public method that returns a list of files in the directory GetFileSystemInfos( )------ Public method that retrieves an array of FileSystemInfo objects MoveTo( )------------------ Public method that moves a DirectoryInfo and its contents to a Refresh( )----------------- Public method inherited from FileSystemInfo; refreshes the stat 77)Like the methods of Directory, all the File methods are static; like DirectoryInfo, all the methods of FileInfo are instance methods. 78)Principal public static methods of the File class Method Use AppendText( ) Creates a StreamWriter that appends text to the specified file Copy( ) Copies an existing file to a new file Create( ) Creates a file in the specified path CreateText( ) Creates a StreamWriter that writes a new text file to the specified file Delete( ) Deletes the specified file Exists( ) Returns true if the specified file exists GetAttributes( ), SetAttributes( ) Gets or sets the FileAttributes of the specified file GetCreationTime( ), SetCreationTime( ) Returns or sets the creation date and time of the file GetLastAccessTime(), SetLastAccessTime()GetLastWriteTime(), SetLastWriteTime( ) Returns or sets the last time the specified file was written to Move( ) Moves a file to a new location; can be used to rename a file OpenRead( ) Public static method that opens a FileStream on the file OpenWrite( ) Creates a read/write Stream on the specified path 79) Methods and properties of the FileInfo class Method or property Use Attributes( ) Inherits from FileSystemInfo; gets or sets the attributes of the current file CreationTime Inherits from FileSystemInfo; gets or sets the creation time of the current fi Directory Public property that gets an instance of the parent directory Exists Public property Boolean value that is true if the directory exists Extension Public property inherited from FileSystemInfo; that is, the file extension FullName Public property inherited from FileSystemInfo; that is, the full path of the file LastAccessTime Public property inherited from FileSystemInfo; gets or sets the last access LastWriteTime Public property inherited from FileSystemInfo; gets or sets the time when the or directory was last written to Length Public property that gets the size of the current file Name Public property Name of this DirectoryInfo instance AppendText( ) Public method that creates a StreamWriter that appends text to a file CopyTo( ) Public method that copies an existing file to a new file Create( ) Public method that creates a new file Delete( ) Public method that permanently deletes a file MoveTo( ) Public method to move a file to a new location; can be used to rename a file Open( ) Public method that opens a file with various read/write and sharing privileges OpenRead( ) Public method that creates a read-only FileStream OpenText( ) Public method that creates a StreamReader that reads from an existing text file OpenWrite( ) Public method that creates a write-only FileStream Returns 80)Reading and writing data is accomplished with the Stream class Principal I/O classes of the .NET Framework Class Use Stream Abstract class that supports reading and writing bytes BinaryReader/BinaryWriter Read and write encoded strings and primitive datatypes to and fro File, FileInfo, Directory, DirectoryInfo Provide implementations for the abstract FileSystemInfo classes, including creating, moving, renaming, and deleting files and directories FileStream For reading to and from File objects; supports random access to files; opens fil synchronously by default; supports asynchronous file access TextReader, TextWriter, StringReader, StringWriter TextReader and TextWriter are abstract classes designed for Unicode character I/ O; StringReader and StringWriter write to and from strings, allowing your input and output to be either a stream or a string BufferedStream A stream that adds buffering to another stream such as a NetworkStream; BufferedStreams can improve the performance of the stream to which they are attached, but note that FileStream has buffering built in MemoryStream A nonbuffered stream whose encapsulated data is directly accessible in memory, most useful as a temporary buffer NetworkStream A stream over a network connection 81)The term binary read is used to distinguish from a text read. If you don t know for certain that a file is just text, it is safest to treat it as a stream of bytes, known as a binary file. 82)A buffered stream object creates an internal buffer, and reads bytes to and from the backing store in whatever increments it thinks are most efficient. It will still fill your buffer in the increments you dictate, but your buffer is filled from the in-memory buffer, not from the backing store. The net effect is that the input and output are more efficient and thus faster. 83)If you know that the file you are reading (and writing) contains nothing but text, you might want to use the StreamReader and StreamWriter classes 84)synchronous I/O, meaning that while your program is reading or writing, all other activity is stopped. It can take a long time (relatively speaking) to read data to or from the backing store, especially if the backing store is a slow disk or (horrors!) a source on the Internet. 85)With large files, or when reading or writing across the network, you ll want asynchronou I/O, which allows you to begin a read and then turn your attention to other matters while the CLR fulfills your request. The .NET Framework provides asynchronous I/O through the BeginRead( ) and BeginWrite( ) methods of Stream. 86)Network I/O is based on the use of streams created with sockets. Sockets are very useful for client/server and peer-to-peer (P2P) applications, and when making remote procedure calls. 87)When an object is streamed to disk, its various member data must be serialized that is, written out to the stream as a series of bytes. The object will also be serialized when stored in a database or when marshaled across a context, app domain, process, or machine boundary. The CLR provides support for serializing an object graph an object and all the member data of that object. By default, types aren t serializable. To be able