这是使用Method集合的Method集合和Method集合的代码示例。

     子方法生命周期

          作为对象的模糊元素

          作为对象的模糊方法

          作为对象的模糊T

          作为整数的模糊IDX

          作为整数的模糊IDX2

          尝试

               element = m_Repository.GetElementByID(129)

               对于idx = 0到element.Methods.Count -1

                    method = element.Methods.GetAt(idx)

                    Console.WriteLine(method.Name)

                    t = method.PreConditions.AddNew(“TestConstraint”,“something”)

                    如果t.Update = false那么

                         Console.WriteLine(“PreConditions:”+ t.GetLastError)

                    万一

                    method.PreConditions.Refresh

                    对于idx2 = 0到method.PreConditions.Count-1

                         t = method.PreConditions.GetAt(idx2)

                         Console.WriteLine(“PreConditions:”+ t.Name)

                         如果t.Name =“TestConstraint”那么

                              method.PreConditions.DeleteAt(IDX2,假)

                         万一

                    下一个

                    t = method.PostConditions.AddNew(“TestConstraint”,“something”)

                    如果t.Update = false那么

                         Console.WriteLine(“PostConditions:”+ t.GetLastError)

                    万一

                    method.PostConditions.Refresh

                    对于idx2 = 0到method.PostConditions.Count-1

                         t = method.PostConditions.GetAt(idx2)

                         Console.WriteLine(“PostConditions:”+ t.Name)

                         如果t.Name =“TestConstraint”那么

                              method.PostConditions.DeleteAt(idx2,false)

                         万一

                    下一个

                    t = method.TaggedValues.AddNew(“TestTaggedValue”,“something”)

                    如果t.Update = false那么

                         Console.WriteLine(“ 标记值:”+ t.GetLastError)

                    万一

                    对于idx2 = 0到method.TaggedValues.Count-1

                         t = method.TaggedValues.GetAt(idx2)

                         Console.WriteLine(“ 标记值:”+ t.Name)

                         如果(t.Name =“TestTaggedValue”)那么

                              method.TaggedValues.DeleteAt(IDX2,假)

                         万一

                    下一个

                    t = method.Parameters.AddNew(“TestParam”,“string”)

                    如果t.Update = false那么

                         Console.WriteLine(“参数:”+ t.GetLastError)

                    万一

                    method.Parameters.Refresh

                    对于idx2 = 0到method.Parameters.Count-1

                         t = method.Parameters.GetAt(idx2)

                         Console.WriteLine(“参数:”+ t.Name)

                         如果(t.Name =“TestParam”)那么

                              method.Parameters.DeleteAt(idx2,false)

                         万一

                    下一个

                    方法=没有

               下一个

          抓住例外

               Console.WriteLine(element.Methods.GetLastError())

               Console.WriteLine(E)

          结束尝试

     结束了