public AbstractSemanticObject[] BuildBs()
 {
     AbstractSemanticObject[] result = new AbstractSemanticObject[5];
     SemanticObjectA a = new SemanticObjectA();
     SemanticObjectC lastC = null;
     for (int i = 0; i < 5; i++)
     {
         SemanticObjectB b = new SemanticObjectB
         {
             IntProperty = i,
             StringProperty = s_SomeStrings[i]
         };
         for (int j = 0; j < 10; j++)
         {
             SemanticObjectC c = new SemanticObjectC
             {
                 B = b,
                 A = a
             };
             lastC = c;
         }
         b.A = a;
         result[i] = b;
     }
     // this creates a loop, as it is downstream, but not a collection
     a.C = lastC;
     return result;
 }
 public void CreateAbstractSemanticObject()
 {
     AbstractSemanticObject result = new SemanticObjectB();
     result = new SemanticObjectA();
     result = new SemanticObjectC();
 }
コード例 #3
0
        internal void RemoveC(SemanticObjectC c)
        {
            Contract.Ensures(!Cs.Contains(c));

            m_Cs.Remove(c);
        }
コード例 #4
0
        internal void AddC(SemanticObjectC c)
        {
            Contract.Requires(c != null);
            Contract.Requires(c.B == this);
            Contract.Ensures(Cs.Contains(c));

            if (!m_Cs.Contains(c))
            {
                m_Cs.Add(c);
            }
        }