Articles of level

C# Console programs are easy to develop. They read input & write output. The purpose of this topic is to introduce you with the C# development environment as you build the simplest form of C# console application program. Because console applications perform all their input and output at the command line, they are ideal for quickly trying out language features and writing command-line utilities.

Classes have complicated internal structures, including data and functions, object initialization and cleanup for classes is much more complicated than it is for simple data structures. The difference is-

  1. Constructors and destructors are special member functions of classes that are used to construct and destroy class objects. 
  2. Construction may involve memory allocation and initialization for objects. Destruction may involve cleanup and deallocation of memory for objects.
  3. Constructors and destructors do not have return types nor can they return values.
  4. References and pointers cannot be used on constructors and destructors because their addresses cannot be taken.
  5. Constructors cannot be declared with the keyword virtual.
  6. Constructors and destructors cannot be declared const, or volatile.
  7. Unions cannot contain class objects that have constructors or destructors.
  8. Constructors and destructors obey the same access rules as member functions. For example, if you declare a constructor with protected access, only derived classes and friends can use it to create class objects.
  9. The compiler automatically calls constructors when defining class objects and calls destructors when class objects go out of scope. 
  10. A constructor does not allocate memory for the class object it’s this pointer refers to, but may allocate storage for more objects than its class object refers to. If memory allocation is required for objects, constructors can explicitly call the new operator. During cleanup, a destructor may release objects allocated by the corresponding constructor. To release objects, use the delete operator.

Method Overriding: Overriding means changing the functionality of a method without changing the signature. We can override a function in base class by creating a similar function in derived class. This is done by using virtual/overrides keywords.
Base class method has to be marked with virtual keyword and we can override it in derived class using override keyword. Derived class method will completely overrides base class method i.e. when we refer base class object created by casting derived class object a method in derived class will be called.

Use method overloading in situation where you want a class to be able to do something, but there is more than one possibility for what information is supplied to the method that carries out the task. 
You should consider overloading a method when you for some reason need a couple of methods that take different parameters, but conceptually do the same thing. 

Polymorphism means many forms (ability to take more than one form). In Polymorphism poly means “multiple” and morph means “forms” so polymorphism means many forms. Polymorphism provides following features: 

  • It allows you to invoke methods of derived class through base class reference during runtime.
  • It has the ability for classes to provide different implementations of methods that are called through the same name.
In polymorphism we will declare methods with same name and different parameters in same class or methods with same name and same parameters in different classes. Polymorphism has ability to provide different implementation of methods that are implemented with same name.

The StringBuilder provides amazing flexibility when we require more complex operations.System.Text contains StringBuilder() object.

Strings are the collections of texts.Unlike old C language; a string doesn’t terminate when it finds /0 character. We can use both the keywords String or string in C#.Point to be noted that if we are concerned about security issues regarding string manipulation;we have to give importance to the String keyword.We have already declared as well as initialized strings in previous lessons.In order to refresh your memory;I will highlight them;

You can redefine or overload most of the built-in operators available in C#. Thus a programmer can use operators with user-defined types as well. Overloaded operators are functions with special names the keyword operator followed by the symbol for the operator being defined. similar to any other function, an overloaded operator has a return type and a parameter list.User-defined types such as classes,structures etc; often overload operators by defining a member function which is static using the operator keyword.We can not overload each and every operator by this approach

We can write the client side validation control in jquery-

In this article I will show you how to make Login Form in Windows Application using C# where I will enter a dummy data in the form of username and password and will check that the entered data by the user is correct or not. if it is correct, the user gets into his account.

Displaying 1 of 4Next
1 2 3 4
Need Help? Contact Us.

Log in


Forgot password?


New User