Posts

Showing posts from June, 2011

C# notes part ->6

File Implementing file IO concepts: Stream: A stream is a sequence of bytes traveling from source to destination over a communication path. The streams are 1.   Input stream 2.   Output stream Input stream is used for read operation. Output stream is used for write operation. In order to perform operations like  file creation, file deletion, read, write operations to a file, we require System.IO namespace. System.IO | | FileReader StreamReader StreamWriter BinaryWriter DirectoryInfo FileInfo If data of a file is only text then we can use StreamReader  and StreamWriter classes to perform reading and writing. StreamReader class             | Close() Peck() Read() ReadLine() Seek() FILE STREAM:  To open an existing file or to  create a new file, we require an object of type FileStream Syntax: FileStream obj = new FileStream(“filename”,FileMode enumerator,FileAccess enumerator,FileShare enumerator); Write a program to read data from the existing file using System; using Syst

C# notes part ->5

Exception Handling An exception is a erroneous situation that occurs during program execution. When an exception occurs in an application, the system throws an error. The error is handled through the process of exception handling. Error :which stops normal exception of a program. Types of Errors: 1.   Compile time/syntax error 2.   Runtime error 3.   Logical error 1.           Syntax errors are the errors which occur when statements are not constructed properly. 2.           Runtime errors are the errors which occur when an application attempts to perform an operation which is not allowed at runtime. 3.           Logical errors are the errors which occurs when an application  compiles and runs properly but doesn’t produce the expected results. These are also called as bugs. In order to trace out the bugs we have a procedure called debugging process. In debug menu of visual studio we have debugging o0ptions  like step into (F11) and step over (F10). Step into à line by line executio