❔ ✅ remove from list (RevitAPI)
I have started learning C# today. Please bare with me 🙂
I am trying to remove an element from an list if its existing, otherwise add it.
I seem too only be able to run whats in the else, and never if the list contains the element.
The logic works, as I have it in python already:
6 Replies
yes
Ah right, so how would I go about doing it in C#?
in ref to this
I think this will help
I actually thought that was defining the type
so
That might be it
I thought you had to tell it the type of thing thats going to be in the list
like for example a string, you'd put string
so I'd put int as its IDs?
So each time an element is selected on the page, it adds to a list, however if its clicked again, I want to remove it from the list. The way I made works in python and am trying to convert to C#, but also learning C# while I do it haha.
the first time it'd have nothing in it sure, but I want to basically do the same thing I did in python,
pop
it if its exists, otherwise add it to the list
in C yeah?
just making sure
im confused if you're talking about C or py
https://pastebin.com/uNvgKT2e
my comments are all over the place im yet to "sort" them
Ahhhhhhhhh
Silly mistake, but thank you for spotting!
Make sense tbf!
Thank you for the help, seem to be okay atm, probs because this is an API so just need to do minor adjustments 😄 nice for me to learn C# though!
Take care!Closed!
Looks like nothing has happened here. I will mark this as stale and this post will be archived until there is new activity.