Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old February 17th, 2007, 01:42 PM
Registered User
Join Date: Feb 2007
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to nir_pankaj
Default Two namespace contain same name

If suppose in any program there are two nameapaces referenced by using contain a type of same name as exa.--->
  say classs called namespaceclass exists both in the test.example
and welcome.example then how we should access class namespaceclass of first namespace.

Pankaj Kumar Verma
Old February 21st, 2007, 12:30 PM
planoie's Avatar
Friend of Wrox
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts

If you have two classes of the same name in different namespaces:


And both libraries are used in some code:

using MyCompany.Project1;
using MyCompany.Project2;

  MyClass objInstance = new MyClass();

You will get an ambiguity error (i.e. the compiler doesn't know which to use).

You need to explicitly identify the class type by a fully qualified name:

  MyCompany.Project2.MyClass objInstance = new MyCompany.Project2.MyClass();


Similar Threads
Thread Thread Starter Forum Replies Last Post
Namespace ~Bean~ Classic ASP Basics 2 June 3rd, 2005 02:31 PM
namespace Ibn_Aziz C# 2 December 25th, 2003 05:41 AM
namespace within namespace Bill Crawley XML 1 December 11th, 2003 10:59 AM
Namespace flute Pro VB.NET 2002/2003 2 October 21st, 2003 09:15 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.