C#

C# (pronounced Csharp) is a new programming language introduced by Microsoft with the Microsoft .NET framework. It was first created in the late 1990’s as part of Microsoft’s.NET strategy. It is a new language free of backward compatibility and a bunch of new, exciting and promising features.
It is an Object Oriented Programming language, which at its core, and has similarities with Java, C++ and VB. The main brains behind C# were Anders Hejlsberg and Scott Wiltamuth. However, many other personalities like Rob Howard, Scott Guthrie were also involved behind C# and the .NET Framework.

Graphical Device Interface (GDI) In C#

GDI+ is next evolution of GDI for the .Net Platform. All GDI+ classes reside in the following namespaces: • System.Drawing • System.Text • System.Printing • System.Internal • System.Imaging • System.Drawing2D • System.Design The Graphics Class The Graphics class encapsulates GDI+ drawing surfaces. Before drawing any object (for example circle or rectangle) we have to create …

Graphical Device Interface (GDI) In C# Read More »

Sample Examples:

Drawing a rectangle   You can override OnPaint event of your form to draw an rectangle. The LinearGradientBrush encapsulates a brush and linear gradient.   protected override void OnPaint(PaintEventArgs pe) { Graphics g = pe.Graphics ; Rectangle rect = new Rectangle(50, 30, 100, 100); LinearGradientBrush lBrush = new LinearGradientBr ush(rect, Color.Red, Color.Yellow, LinearGradientMode.BackwardDiagonal); g.FillRectangle(lBrush, rect); …

Sample Examples: Read More »

Files & Folders In C#

One of the ways of permanent storage of data is through files. A file is a collection of data stored on a secondary storage device, such as the Hard Disk. Every file has a name associated with it, such as CSITquestion.txt. The name comprises of two parts the base name (in our case ‘CSITquestion) and …

Files & Folders In C# Read More »

Stream In C#

A stream is a sequence of bytes traveling from a source to a destination over a communication medium. Streams can either be input stream or output stream. The input stream is used for reading while the output stream is used for writing.   Note: This stream concept does not just apply to files. It holds …

Stream In C# Read More »

Creating Objects In C#

Creating a DirectoryInfo or FileInfo object is very simple. The constructor takes the path to the file.   DirectoryInfo di = new DirectoryInfo(“C:\\Windows”); FileInfo fi = new FileInfo(“C:\\Windows\\Notepad.exe”);   Listing All Files in a Directory   The following code snippet lists all the files in the “C:\Windows” directory.   DirectoryInfo di = new DirectoryInfo(“C:\\Windows”); FileInfo[] …

Creating Objects In C# Read More »

What are Generics in C# ?

According to MSDN, “Generics introduce to the .NET Framework the concept of type parameters, which make it possible to design classes and methods that defer the specification of one or more types until the class or method is declared and instantiated by client code.”   By using Generics, classes and methods can work uniformly on …

What are Generics in C# ? Read More »

Types In C#

Types In C# The C# language types are divided into three main categories:   ? Value types ? reference types ? pointer types   Notes:   ** Value types include simple types (e.g., char, int, and float), enum types, and struct types. ** Reference types include class types, interface types, delegate types, and array types. …

Types In C# Read More »