How the using statement is used to specify namespaces : NameSpace : Language Basics C# Source Code


Custom Search

C# Source Code » Language Basics » NameSpace »

 

How the using statement is used to specify namespaces









    

/*
Mastering Visual C# .NET
by Jason Price, Mike Gunderloy

Publisher: Sybex;
ISBN: 0782129110
*/

/*
  Example6_10.cs illustrates how the using
  statement is used to specify namespaces
*/

using Sybex;
using System;


public class Example6_10
{

  public static void Main()
  {

    // the Console.WriteLine() call uses the System namespace
    Console.WriteLine("Creating a Sybex.Car object");

    // create a Car object (uses the Sybex namespace)
    Car myCar = new Car();

    myCar.make = "Toyota";
    Console.WriteLine("myCar.make = " + myCar.make);

  }

}

namespace Sybex
{

  // declare the Car class
  public class Car
  {
    public string make;
  }

}



           
       
    
   
  
   







HTML code for linking to this page:

Follow Navioo On Twitter

C# Source Code

 Navioo Language Basics
» NameSpace