如题,我在C#书中看到的一句话,谁能帮我解释下。怎么都看不明白,谁能给个举个例子;最好可以把错误 也一起发出来,一定要在机子上调试啊

解决方案 »

  1.   

    我也看到这句话 using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;namespace test1
    {
        namespace test1
        {
            namespace test2
            {
                namespace test3
                {
                    namespace test4 
                    {
                    
                    }
                    namespace test5
                    {
                        class tt
                        {
                            public void speak()
                            {
                                Console.WriteLine("11");
                            }
                        }
                            namespace test7.test8.test9
                        {
                            class test
                            {
                               public  static void speak()
                                {
                                    Console.WriteLine("11");
                                }
                            }
                        }
                    }
                    namespace test6
                    {                
                    class Program
                    {
                        static void Main(string[] args)
                        {
                            test1.test2.test3.test5.test7.test8.test9.test.speak();
                        }                    
                    }
                }
                }
            }
        }
    }
    但是我这样嵌套一点问题都没有 ,不知道是怎么回事
      

  2.   

    名称空间是.NET中提供应用程序代码容器的方式,这样可以惟一标识代码及其内容。名称空间也可以用做.NET Framework 中给项分类的一种方式,而大多数项都是类型定义的。默认情况下,代码包含在全局名称空间中。这意味着对于包含在这段代码中的项,只要按照名称进行引用,就可以由全局名称空间中的其他代码访问它。