If there any short way besides foreach loop and new collection creation to add object after specific object in existing List ?
Just an example:
“amy”,”jerry”,”tony”,”amy”,”jack”.
I want to add “simon” after each “amy” in short way
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can use Linq to do this.
Uses a foreach but you can put it into a extension method to keep the code clear.
Extension method
You can easily put this into a extension method.
Now the call: