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.

In this article, I would like to show how to create a SQL Server Database Backup file programmatically in C#.Net. Using this code you can make database backup utility in your programs/apps.

If you call a non-static method in static method then you should make an object of that non-static method and call it. Example- 

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 global assembly cache (GAC) is a machine-wide code cache that stores assemblies specifically designated to be shared by several applications on the computer. You should share assemblies by installing them into the global assembly cache only when you need to.Steps

you can get the path of running .exe file written by this sample code-
Async and Await keywords used for asynchronous programming in C#.
Displaying 1 of 6Next
1 2 3 4 5 6
Need Help? Contact Us.

Log in


Forgot password?


New User