Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 2005 > C# 2005
|
C# 2005 For discussion of Visual C# 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# 2005 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 April 12th, 2007, 10:45 AM
Registered User
 
Join Date: Apr 2007
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default About Namespace

Hello!Expert.I am learning about C Sharp.I bought a book from bookshop.The book's name is <<Professional C#, 3rd Edition>>.As a result,I have faced a lot of difficulties.Now I want to asked a question.What is the mean of the book's sentence?The sentence is at Page 58,it is "Note that we are not permitted to declare a multi-part namespace nested within another namespace."Please give me a example(Code).Thank you!
 
Old April 12th, 2007, 11:13 AM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

It appears the book in question is based on .Net 1.1.

What they are saying is:

You CAN do this:

namespace Cheese
{
    namespace MoreCheese
    {
    }
}

But you can NOT do this:

namespace Cheese
{
    namespace Stinky.Cheese
    {
    }
}

If you try to compiled the second one in 1.1 you get this error:

error CS0134: Cannot use qualified namespace names in nested namespace declarations

THIS ONLY APPLIES TO .NET 1.1. .Net 2.0 DOES allow this.

-Peter
 
Old April 13th, 2007, 03:12 AM
Registered User
 
Join Date: Apr 2007
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for your relication.
I tried to complie a example in 2.0,I don't get a error,and there is the same sentece in <<Professinal C# 2005>> as <<Professional C#, 3rd Edition>>.

 
Old April 13th, 2007, 03:20 AM
Registered User
 
Join Date: Apr 2007
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Note that we are not permitted to declare a multi-part namespace nested within another namespace.


 
Old April 13th, 2007, 08:04 AM
Registered User
 
Join Date: Apr 2007
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I make sure that the book is wrong!


 
Old April 13th, 2007, 08:15 AM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

It would seem that the book is incorrect. It's also possible that when the book was written, MS hadn't made this change. Given the amount of time it takes to write a book, it's understandable that changes in the software could be made that affect the accuracy of the book.

-Peter





Similar Threads
Thread Thread Starter Forum Replies Last Post
Two namespace contain same name nir_pankaj C# 1 February 21st, 2007 12:30 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.