Book a Demo

Author Topic: How to delete an element  (Read 3390 times)

Simone15

  • EA Novice
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
How to delete an element
« on: May 21, 2008, 11:05:26 pm »
Hi,
I'm writing a C# AddIn for EA, I need to delete some elements (requirements) from the model, but I didn't find in the Element or Repository classes a method to cancel.
How can I do it?

(Sorry for my english  ;))
« Last Edit: May 21, 2008, 11:08:48 pm by simonere »

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: How to delete an element
« Reply #1 on: May 22, 2008, 06:24:54 am »
In general you delete an element (or pretty much anything else) from EA by deleting it (the element) from its parent collection.

So, find a reference to the collection containing the requirement (perhaps the Elements collection of a package) and use either the Delete() or DeleteAt method of the collection. Remember that the index is a short (i.e. 16-bit) integer.

HTH, David
No, you can't have it!

Simone15

  • EA Novice
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
Re: How to delete an element
« Reply #2 on: May 22, 2008, 08:29:35 pm »
Thank you very much David, this method works well  :)