Members

Technology Zones

Articles

Hosted By

MaximumASP

Info

Rated
Read 48,845 times

Contents

Related Categories

The Quick & Dirty .NET Guide to C#/VB OOP - Namespaces

DMarko1

Namespaces

.NET furthers the scope of OOP by compartmentalizing objects within namespaces, as an excellent means of categorizing and personalizing common and related fields, classes , structs or interfaces as a collection , as well as other namespaces known as nested namespaces! When including namespaces in an application, C# uses the " using " keyword to do that, whereas VB specifies " Imports " .

This is what facilitates and advances proper reusability and OOP practices. Devoid of this, you would have little structure. Creating a library of common class filled namespaces makes for a well-created application, always having modular components ready for use.

[C#]
namespace JimsEstate {
  public class House { ... }
  public class Car { ... }
  public class Garage { ... }
}

[VB]
Namespace JimsEstate
  ' Classes and other types of members go here
End Namespace

Here we have the namespace JimsEstate that contains a House, Car and Garage. All are neatly categorized together, and confusion in minimized, thus namespaces. Naming namespaces could easily extend beyond this. JimsEstate could be named JimsEstate.Land.NewYork.LongIsland, if you so choose. That's cool!

At any rate, we'll now look at one of the component types within - classes .

Dimitrios, or Jimmy as his friends call him, is a .NET developer/architect who specializes in Microsoft Technologies for creating high-performance and scalable data-driven enterprise Web and desktop applications. Till now Jimmy has authored nearly two dozen .NET articles, published on Dot Net Junkies, 4 Guys From Rolla, Sitepoint, MSDN Academic Alliance, Developers.NET, The Official Microsoft ASP.NET Site, and here on Developer Fusion, covering various unique and advanced techniques on .NET.

Comments

  • Re: [4341] The Quick & Dirty .NET Guide to C#/VB OOP

    Posted by Yoenuts on 25 Jul 2006

    hello,


    I am very impressed by your tutorial as it finally allowed me to grasp the syntax behind OOP programming with .net.
    Only what I did not understand is how and where do I complile the .cs ...

  • Re: [4341] The Quick & Dirty .NET Guide to C#/VB OOP

    Posted by ggorcsos on 22 Jun 2006

    Honestly I believe that the basic idea of the OOP was really great, but to be able to use it one really has to have the head as a water melon. There is too much theory, too many ther...

  • Posted by James Crowley on 20 May 2005

    Though from personal experience I'd say 99.99% of the time, you'd want private member variables and public properties... ;)

  • Posted by DMarko1 on 22 Apr 2005

    Hi Ehx,

    That's true, and it's funny that in all my other articles I always write all private variables with public properties. i.e. - [url="http://www.developerfusion.co.uk/show/4676/1/"]Building a...

  • Confusion about this article (Get ,Set)

    Posted by aalhussein on 22 Apr 2005

    After reading your article, http://www.developerfusion.com/show/4341/6/
    I got realy confused!!

    from what I know from the book below, I declare private property, then declare public (get , set )
    W...