在一个命名空间A下声明了如下的一个类,我想在另一个命名空间B中赋值;再在另一个命名空间C下引用,怎么做;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;namespace A
{
   public sealed class Test
    {
        public static DateTime _iDatetime;
        public static DateTime iDatetime
        {
            set { _iDatetime = value; }
            get { return _iDatetime; }
        }
    }
}

解决方案 »

  1.   

    using System;
    using System.Collections.Generic;
    using System.Text;namespace A
    {
        public sealed class Test
        {
            public static DateTime _iDatetime;
            public static DateTime iDatetime
            {
                set { _iDatetime = value; }
                get { return _iDatetime; }
            }
        }}using System;
    using System.Collections.Generic;
    using System.Text;
    using A;namespace B
    {
        class Bb
        {
            public Bb()
            {
                Test._iDatetime = DateTime.Now;
            }
        }
    }using System;
    using System.Collections.Generic;
    using System.Text;
    using A;
    using B;namespace ConsoleApplication1
    {
        class Program
        {        static void Main(string[] args)
            {
                Bb b = new Bb();
                
                Console.WriteLine(Test._iDatetime);
                Console.Read();
            }
        }
    }
    这个意思?
      

  2.   

    静态变量是直接通过命名空间+类名+成员名的形式访问的,之所以可以省略命名空间,是同在一个命名空间下或添加了using的缘故,因此这个和多命名空间毫无关系。
      

  3.   

    上面都是对的,很奇怪,我的也是那样写的,我把生成DLL的文件夹改了个文件夹就好了