本帖最后由 afengelf 于 2012-07-16 17:40:42 编辑

解决方案 »

  1.   

    是完全没有必要的,也做不到的。    static class Program
        {
            public class B
            {
                public static B Instance = new B();
                public string StrConnection
                {
                    get;
                    set;
                }
                public int GetDataSet(string sql)
                {
                    return 0;
                }
            }
            public class A : B
            {
                public static string conn = "server=.;uid=sa;pwd=123;database=test";
                public new static A Instance = new A();
                public A()
                {
                    StrConnection = conn;
                }
            }
            static void Main(string[] args)
            {
                A.Instance.GetDataSet("select * from table1");
                B.Instance.GetDataSet("select * from table1");
            }
        }