FAQ About VB.NET

Here is a post that a person called Whizkid2 wrote:

What is Namespace?
A namespace is a logical design-time naming convenience, used mainly to define scope in an application and organize classes and other types in a single hierarchical structure. From the viewpoint of the runtime, there are no namespaces.

What is System Namespace?
The System namespace contains fundamental classes and base classes that define commonly-used value and reference data types, events and event handlers, interfaces, attributes, and processing exceptions. Other classes provide services supporting data type conversion, method parameter manipulation, mathematics, remote and local program invocation, application environment management, and supervision of managed and unmanaged applications.

What is Inheritance?
Inheritance enables you to share and reuse an interface or its members in new ways.
Overridable — Allows a property or method in a class to be overridden in a derived class.
Overrides — Overrides an Overridable property or method defined in the base class.
NotOverridable — Prevents a property or method from being overridden in an inheriting class. Public methods are NotOverridable by default.
MustOverride — Requires that a derived class override the property or method. When the MustOverride keyword is used, the method definition consists of just the Sub, Function, or Property statement. No other statements are allowed, and specifically there is no End Sub or End Function statement. MustOverride methods must be declared in MustInherit classes.

MyBase Keyword
You can use the MyBase keyword to call methods in a base class when overriding methods in a derived class. For example, suppose you are designing a derived class that overrides a method inherited from the base class. The overridden method can call the method in the base class and modify the return value

Restrictions on using MyBase:· MyBase refers to the immediate base class and its inherited members. It cannot be used to access Private members in the class. · MyBase is a keyword, not a real object. MyBase cannot be assigned to a variable, passed to procedures, or used in an Is comparison. · The method that MyBase qualifies does not need to be defined in the immediate base class; it may instead be defined in an indirectly inherited base class. In order for a reference qualified by MyBase to compile correctly, some base class must contain a method matching the name and types of parameters appearing in the call. · You cannot use MyBase to call MustOverride base class methods. · MyBase cannot be used to qualify itself. Therefore, the following code is illegal: MyBase.MyBase.BtnOK_Click() ’ Syntax error.· MyBase cannot be used in modules. · MyBase cannot be used to access base class members that are marked as Friend if the base class is in a different assembly.
MyClass Keyword
The MyClass keyword allows you to call an Overridable method implemented in your class and make sure that implementation of the method in this class is called rather than an overridden method in a derived class. · MyClass is a keyword, not a real object. MyClass cannot be assigned to a variable, passed to procedures, or used in an Is comparison. · MyClass refers to the containing class and its inherited members. · MyClass can be used as a qualifier for Shared members. · MyClass cannot be used in standard modules. · MyClass can be used to qualify a method that is defined in a base class and that has no implementation of the method provided in that class. Such a reference has the same meaning as MyBase.Method.
Delegates
A delegate is a reference type that refers to a Shared method of a type or to an instance method of an object. The closest equivalent of a delegate in other languages is a function pointer, but whereas a function pointer can only reference Shared functions, a delegate can reference both Shared and instance methods. In the latter case, the delegate stores not only a reference to the method’s entry point, but also a reference to the object instance with which to invoke the method.Any attributes specified in the method declaration apply to the delegate itself. The method declaration may not have modifiers, a Handles clause, an Implements clause, a method body, or an End construct. The accessibility domain of the return type and parameter types must be the same as or a superset of the accessibility domain of the delegate itself.The members of a delegate are the members inherited from class System.Delegate. A delegate also contains a set of constructors and methods defined by the system. As these are specified and implemented by the .NET Framework, they are not listed here.There are three steps in defining and using delegates: declaration, instantiation, and invocation.

Constructor
Constructor is a function you call to instantiate and initialize a particular type of object. You invoke a constructor with the new keyword.Constructors are special methods that allow control over initialization. They are run after the program begins or when an instance of a type is created. Unlike other members, constructors are not inherited and do not introduce a name into a type’s declaration space. Constructors may only be invoked by object-creation expressions or by the .NET Framework; they may never be directly invoked.var myObject = new Object();// Creates a generic object with no properties.var myBirthday = new Date(1961, 5, 10); // Creates a Date object.var myCar = new Car();

Destructors
Destructors are used to destruct instances of classes.
A class can only have one destructor.Destructors cannot be inherited or overloaded.Destructors cannot be called. They are invoked automatically. A destructor does not take modifiers or have parameters

Structure
In Visual Basic .NET, the Type statement is not supported. You must declare structures using the Structure statement as part of a Structure … End Structure construction. Every member of a structure must have an access modifier, which can be Public, Friend, or Private. You can also use the Dim statement, which defaults to public access. The structure in the preceding example can be declared as follows: Structure Employee Public EmpNumber As Integer ’ Must declare access, even if Public. Dim EmpOfficePhone As String ’ Still defaults to Public access. Private EmpHomePhone As String’ Can be made Private inside Structure. End Structure

Access Types
The five access types are Public, Protected, Friend, Protected Friend, and Private.· Entities declared with the Public modifier have Public access. There are no restrictions on the use of Public entities. · Entities declared with the Protected modifier have Protected access. Protected access can only be specified on members of classes (both regular type members and nested classes). A Protected member is accessible to a derived class, provided that either the member is not an instance member, or the access takes place through an instance of the derived class. Protected access is not a superset of Friend access. · Entities declared with the Friend modifier have Friend access. An entity with Friend access is accessible only within the program that contains the entity declaration. · Entities declared with the Protected Friend modifiers have the union of Protected and Friend access. · Entities declared with the Private modifier have Private access. A Private entity is accessible only within its declaration context, including any nested entities

Friend Functions
A friend function is a function that is not a member of a class but has access to the class’s private and protected members. Friend functions are not considered class members; they are normal external functions that are given special access privileges.

Common Language Runtime
The common language runtime makes it easy to design components and applications whose objects interact across languages. Objects written in different languages can communicate with each other, and their behaviors can be tightly integrated. For example, you can define a class and then use a different language to derive a class from your original class or call a method on the original class. You can also pass an instance of a class to a method of a class written in a different language. This cross-language integration is possible because language compilers and tools that target the runtime use a common type system defined by the runtime, and they follow the runtime’s rules for defining new types, as well as for creating, using, persisting, and binding to types.

Abstract Classes
Abstract classes are closely related to interfaces. They are classes that cannot be instantiated, and are frequently either partially implemented, or not at all implemented. One key difference between abstract classes and interfaces is that a class may implement an unlimited number of interfaces, but may inherit from only one abstract (or any other kind of) class. A class that is derived from an abstract class may still implement interfaces. 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.

Interfaces in Visual Basic .NET
Interfaces define the properties, methods, and events that classes can implement. Interfaces allow you to define features as small groups of closely related properties, methods, and events; this reduces compatibility problems because you can develop enhanced implementations for your interfaces without jeopardizing existing code. You can add new features at any time by developing additional interfaces and implementations

Arrays
The main difference between VB.NET and VB6 based arrays are VB.NET arrays always starts from the element zero