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….

Constructors And Destructors – C# Basic Programming

Posted in C#Tagged ,

Constructors and Destructors are the very small chapter in C# and can be learned easily. It is easy to understand concept of constructors and destructors. What are Constructors and Destructors in C#? Constructors: Constructors are the special method of class which is used when create object. It like  to method but it has same name as….

Overflow Exception Handling Using Checked And Unchecked

As a C# programmer you always should be always aware of right output of arithmetic operation. Your code might be right, there is no runtime exception still your output may be wrong and it may cause important problem in your project. To understand this theory, see below programming example first. Example: using System; using System.Collections.Generic; using System.Linq; using System.Text;….

User Defined Exception Class In C#

In the previous chapter we have learned about try catch and finally keyword these are the basic building block of exception handling. In this chapter we will learn a new keyword “throw” in exception handling. This keyword is used for creating custom exception class or creating user defined exception class in C#. While creating custom exception….

Try Catch Finally In C#

Posted in C#Tagged , ,

Try Catch Finally is the  building block of exception handling in c#. ‘Try’ block keeps the code which may through exception at runtime. The ‘catch’ block handle the exception if try block rais error and ‘finally’ block executes always exception is raised or not. A try block may have multiple catch blocks. Example: using System; using System.Collections.Generic;….

Exception Handling In C# With Programming Examples

Posted in C#Tagged ,

Before starting to learn about Exception handling, it is required to know what actually Exception is and why it is required to learn exception handling. Exception means for programming error which appears at runtime. For example you have create a program in which user inputs two numbers and program divide the number and show output. Now consider what happen….

Array Class And Function In C#

Posted in C#Tagged , ,

Array class is the base class of all the arrays in C# programming. Array class is defined within the system namespace. Array class provides number of predefined functions and properties to work with. Its function makes array much easier and simpler to work. int[] arr = new int[4]; MOST COMMON PROPERTIES OF ARRAY CLASS Properties….