Archive for the ‘C#. Net’ Category

C# Generics


  • With the language constructs you’ve learned so far, you can build powerful objects of many different types. You do this mostly by declaring classes that encapsulate the behavior you want and then creating instances of those classes.
  • All the types used in the class declarations so far have been specific types—either programmer defined or supplied by the language or the BCL. There are times, however, when a class would be more useful if you could “distill” or “refactor” out its actions and apply them not just to the data types for which they are coded but for other types as well.
  •  Generics allow you to do just that. You can refactor your code and add an additional layer of abstraction so that, for certain kinds of code, the data types are not hard-coded. This is particularly designed for cases in which there are multiple sections of code performing the same instructions, but on different data types.
  • So that i think it is time to learn more about generics …. the following artical will talk about generics and catch the headlines that will help you invest generics in your code .. leaving you with the  artical .. hoping to be helpful
  • Download
Categories: C#. Net

Building Multithreaded Application in C# 3.5

August 1, 2010 1 comment

This Article Demonstrates how to use MultiThreading in c# programming , and the new updates in  .Net FrameWork 2.0 SDK, and Discuss many problems and illustrates how to solve it such as Concurrency, so lets see what this subject talks about



Visual CSharp® 2005 How to Program, 2nd Ed – [Prentice Hall]

Pro-C# 2008-and-the-NET-3.5-Platform 4th Edition Apress

For more information

Categories: C#. Net

Events and Delegates Concepts

December 3, 2007 Leave a comment

If you do not know how to implement and invoke custom events, then you will not be able to write code that will interoperate with event-oriented code written by other programmers.This document introduces events and delegates and shows you how to impelement your custom events



Categories: C#. Net

OOP Concepts briefly

November 20, 2007 1 comment

Before Talking about ” OOP Concepts ” we must ask ourselves three simple questions:-

What Is Object-Oriented Programming?

Object-oriented programming is a relatively new approach to creating computer applications that seeks to address many of the problems with so-called traditional programming techniques.

What is Object Technology ?

Object Technology is developing software based in objects

an Object is a combination of data and functions

Why  Object Technology ?

object technology makes a natural way of thinking – about problem domain, not about processes and procedures.

Any full OOP programming Languages must have these four features:-

  • Encapsulation
  • Abstraction
  • inheritance
  • Polymorphism

First we will talk about Encapsulation concept(classes , objects , methods, access modifiers , etc) :

  • Performing a task in an application requires a method. The method describes the mechanisms that actually perform its tasks. The method hides from its user the complex tasks that it performs, just as the accelerator pedal of a car hides from the driver the complex mechanisms of making the car go faster.

Ex:- Simple Method  implementation

// Public is the access modifier of the method and void is the return type

Public void accelerat()



  • Class is an application unit that house for method and other things just as a car’s engineering drawings house (among other things) the design of an accelerator pedal. In a class, you provide one or more methods that are designed to perform the class’s tasks. Just as you cannot drive an engineering drawing of a car, you cannot “drive” a class. Just as someone has to build a car from its engineering drawings before you can actually drive a car, you must build an object of a class before you can get an application to perform the tasks the class describes.

Ex- Simple Class code implementation

Using system;

class pedal



  • Interfaces : An interface is a collection of public methods and properties that are grouped together to encapsulate specific functionality. Once an interface has been defined, you can implement it in a class. This means that the class will then support all of the properties and members specified by the interface.

  • Access modifier is a keyword used to provide the means for determining which code has access to the members of a class

To apply an access modifier to a class member , you simply precede the member with one of the  access modifier keywords .

Public Members access is extended to all code throughout the entire program
Protected Member access is limited to code of the same class and methods of derived classes in the same program
Private Member access is limited to the code within methods of the same class in the same program.
Internal Member access is limited to code within all methods of all classes within the same assembly

Second: Abstraction

  • Classes normally hide the details of their implementation from their clients. This is called information hiding. As an example, let us consider the stack data structure Recall that a stack is a last-in, first-out (LIFO) data structure the last item pushed (inserted) on the stack is the first item popped (removed) off the stack. Stacks can be implemented with arrays and with other data structures, such as linked lists A client of a stack class need not be concerned with the stack’s implementation  . The client knows only that when data items are placed in the stack, they will be recalled in last-in, first-out order. The client cares about what functionality a stack offers, not about how that functionality is implemented. This concept is referred to as data abstraction

Ex:- Simple code of Abstract class implementation

Using system;

Abstract class pedal



Third : inheritance

Inheritance relationships form tree-like hierarchical structures A base class exists in a hierarchical relationship with its derived classes. When classes participate in inheritance relationships, they become “affiliated” with other classes. A class becomes either a base class, supplying members to other classes, or a derived class, inheriting its members from another class. In some cases, a class is both a base class and a derived class as shown in the below figure.

inheritanceInheritance allows you to extend or create more specific classes from a single, more generic base class

Fourth: Polymorphism

Polymorphism enables us to “program in the general” rather than “program in the specific.” In particular, polymorphism enables us to write applications that process objects that share the same base class in a class hierarchy as if they are all objects of the base class.( Ploy ) means “has many forms”. interfaces , abstract methods, virtual methods and override methods is forms of polymorphism.

sealed Methods and Classes

We saw in that only methods declared virtual, override or abstract can be overridden in derived classes. A method declared sealed in a base class cannot be overridden in a derived class . Methods that are declared private are implicitly sealed, because it is impossible to override them in a derived class (though the derived class can declare a new method with the same signature as the private method in the base class). Methods that are declared static also are implicitly sealed, because static methods cannot be overridden either. A derived class method declared both override and sealed can override a base class method, but cannot be overridden in derived classes further down the inheritance hierarchy.


How to program  second edition( C# 2005) [book]

Beginning Visual CSharp 2005 – Wrox  [book]

for more information follow the below link


Categories: C#. Net

Why Is Method Main Declared static?

January 20, 2007 Leave a comment

Why must Main be declared static ? During application startup when no objects of the class have been created, the Main method must be called to begin program execution. The Main method is sometimes called the application’s entry point. Declaring Main as static allows the execution environment to invoke Main without creating an instance of the class. Method Main is often declared with the header:

public static void Main( string args[ ] )

Categories: C#. Net