预订演示

请注意 : 本帮助页面不适用于最新版本的Enterprise Architect. 最新的帮助文档在这里.

前页 后页

Stereotypes

This is some example code for adding and deleting stereotypes.

     Sub TestStereotypes

          Dim o as object
          Dim idx as integer

          ''add a new stereotype to the Stereotypes collection
          o = m_Repository.Stereotypes.AddNew("funky","class")
          If(o.Update=false) Then
               Console.WriteLine (o.GetLastError())
          End if
          o = nothing

          ''make sure you refresh
          m_Repository.Stereotypes.Refresh

          ''then iterate through - deleting our new entry in the process
          For idx = 0 to m_Repository.Stereotypes.Count-1
               Console.Writeline(m_Repository.Stereotypes.GetAt(idx).Name)
               If(m_Repository.Stereotypes.GetAt(idx).Name = "funky") then
                    m_Repository.Stereotypes.DeleteAt(idx,false)
                    Console.WriteLine("Delete element")
               End if
          Next

     End Sub