VB.NET:An introduction to Namespaces in .NET framework

2,070 views 7 slides Oct 26, 2017
Slide 1
Slide 1 of 7
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7

About This Presentation

What is Namespace in VB.net.


Slide Content

Namespaces Presented By: Ms Richa Handa

The most common way that VB.NET namespaces are used by most programmers is to tell the compiler which .NET Framework libraries are needed for a particular program. .NET codes can be organized using namespaces. Namespaces organize the objects defined in an assembly. Namespaces are not replacements for assemblies, but a second organizational method that complete assemblies. Namespaces are a way of grouping type names and reduce the chance of name collisions.

Example: For example a button type is contained in system.windows.forms namespace. This is actually shorthand for the situation shown in figure below: Button class Form Namespace Window Namespace System Namespace

Declare a namespace System  is the basic namespace used by every .NET code. There are lots of namespace user the system namespace. For example, System.IO, System.Net , System.Collections , System.Threading , System.Data , Ststem.Drawing , etc.

VB.NET Code: Namespace College Namespace students Imports System Class  Addstudents Public Function  S_Method () Console.WriteLine ("Adding Students to college using S_Method !") End Function End Class End Namespace End Namespace

Let's look how we can use the namespaces in our code. I'm going to create a program to use the namespaces. VB.NET Code: Imports System Class  HelloWorld Public Sub Main() Dim  AddStd  As  Student.AddStudent = New  AddStudent AddStd.S_Method () End Sub End Class

Thank You!