How many types of expection in c#


Exception is an event that occur during the execution of program that disrupts the normal flow of them program. When an exception occur its object are created by the method in which an exception occurs, which is handle by the default exception handler. The object contains all the details of the exception and its type etc. Exception Handler is a….

C# BinaryReader Tutorial With Programming Examples And Codes

Posted in C#Tagged ,

If you have bin file stored in your PC and you want to read them then BinaryReader may help you lot. BinaryReader class is used to reading binary files. A binary file stored data in different layout that is more efficient for machine but not convenient for human. BinaryReader makes this job simpler and show you exact data stored in bin….

C# BinaryWriter Class With Programming Examples And Codes

Posted in C#Tagged ,

BinaryWriter class writes Primitive type data type as int, uint or char in binary to a stream. As its name says BinaryWriter writes binary files that uses a specific data layout for its bytes. BinaryWriter create binary file that is not human understandable but the machine can understand it more smoothly. It supports writing string in a specific encoding. BinaryWriter class provides methods that simplify writing….

C# TextReader Class With Programming Example

Posted in C#Tagged , ,

TextReader Class represents a reader that can read a sequential series of Characters. It is abstract class that means you cannot instantiate it. After finishing reading or writing file you must disposeor clean memory directly or indirectly. To directly dispose, call Dispose Method in try/catch block and for indirectly disposal write code inside using block. Programming Examples: In this programming Example I will open D:\csharpfile.txt using….

C# TextWriter Tutorial With Programming Examples

Posted in C#Tagged , ,

The TextWriter class represents a writer that can write sequential series of characters. You can also use this class to write text in a file. It is an abstract base class of StreamWriter and StringWriter, which write characters to streams and string respectively. Example: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using….

C# StreamReader Class With Programming Example

Posted in C#Tagged , , ,

StreamReader class allows you to read text files very easily. Its implementation is very easy and it is most popular among the programmer. However, there are many of way to read text file in C# file handling but StreamReader Class is more popular in list. Important Points about StreamReader Class Implements a TextReader that reads characters from….

StreamWriter Class In C# With Programming Example

Posted in C#Tagged , ,

StreamWriter Class is more popular in File Handling and it is simple helpful in writing text data in file. It is simple to use and provides complete set of constructors and methods to work. It is very simple to writer data into a text file using StreamWriter Class and most of the beginners prefer to use this….

C# FileStream Tutorial With Programming Example

Posted in C#Tagged ,

FileStream Class is used to execute the basic operation of reading and writing operating system files. FileStream class helps in reading from, writing and closing files. In order to use FileStream class you need to include System.IO namespace and then create FileStream Object to create a new file or open an existing file. FileStream <object_name>….

C# Destructor

Posted in C#Tagged ,

Destructors are the way to remove instances of classes as soon as class closed. It is very important to clean memory and remove all the instances of program. Using of destructors you can clean memory if your program is using expensive external resource as files, image etc. Note: You should not use empty destructor in program. When you….

C# Constructor –Learn With Programming Example

Posted in C#Tagged ,

A constructor is a special type of method which is used to initialize object when it is created. To understand its definition we take an example. You are creating a class in which you are required a temperature value in centigrade and in then use that value in entire class. A constructor is used here….