Tuesday, 5 December 2017

Programming Technologies and Terminology

  • Name spaces
The namespace keyword is used to declare a scope. This namespace scope lets you organize code and gives you a way to create globally-unique types. Even if you do not explicitly declare one, a default namespace is created.
  • Method overloading
It occurs when a class contains two methods with the same name, but different signatures.
  • Sealed classes
sealed modifier is used to prevent derivation from a class. A compile-time error occurs if a sealed class is specified as the base class of another class. (A sealed class cannot also be an abstract class)

Protected and protected internal, “internal” access-specifier
A good bit of explanation is there but u asked for brief so briefing these we can say that in protected - Access is limited to the containing class or types derived from the containing class and in internal - Access is limited to the current assembly and in protected internal - Access is limited to the current assembly or types derived from the containing class.
  • Constructor and instance constructor
 Instance constructor is executed when a new instance of type is created and the class constructor is executed after the type is loaded and before any one of the type members is accessed and also class constructors are used for static field initialization.
  • Method Overriding
use the override modifier to modify a method, a property, an indexer, or an event. An override method provides a new implementation of a member inherited from a base class. The method overridden by an override declaration is known as the overridden base method. The overridden base method must have the same signature as the override method.
You cannot override a non-virtual or static method. The overridden base method must be virtual, abstract, or override
  • Interface or Abstract Class
the interface and abstract this will help you
Interfaces, like classes, define a set of properties, methods, and events. But unlike classes, interfaces do not provide implementation. They are implemented by classes, and defined as separate entities from classes. Even though class inheritance allows your classes to inherit implementation from a base class, it also forces you to make most of your design decisions when the class is first published.

Abstract classes are useful when creating components because they allow you specify an invariant level of functionality in some methods, but leave the implementation of other methods until a specific implementation of that class is needed. They also version well, because if additional functionality is needed in derived classes, it can be added to the base class without breaking code.
  • Destructors
 In C# you can never call destructor, the reason is one cannot destroy an object.It's the .Net frameworks Garbage Collector (GC) who has the control over the destructor in C#. GC destroys the objects only when necessary.
Regarding points these are

  1. Destructors are invoked automatically, and cannot be invoked explicitly.
  2. Destructors cannot be overloaded. Thus, a class can have, at most, one destructor.
  3. Destructors are not inherited. Thus, a class has no destructors other than the one, which may be declared in it.
  4. Destructors cannot be used with structs. They are only used with classes.
  5. An instance becomes eligible for destruction when it is no longer possible for any code to use the instance.
  6. Execution of the destructor for the instance may occur at any time after the instance becomes eligible for destruction.
  7. When an instance is destructed, the destructors in its inheritance chain are called, in order, from most derived to least derived
CAS is Code Access Security. It is the part of the .NET security model that determines whether or not a piece of code is allowed to run, and what resources it can use when it is running.

An argument passed to a ref parameter must first be initialized. Compare this to an out parameter, whose argument does not have to be explicitly initialized before being passed to an out parameter.