Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Create the list of items
- var items = new List<Items>()
- items.Add("Apple")
- items.Add("Orange")
- // This list will temporarily hold duplicates of the original items
- var duplicates = new List<Items>();
- // Loop through the original items and add each item to the list of duplicates
- foreach (Items item in items)
- {
- duplicates.Add(item);
- }
- // Loop through the duplicates and add the item back into the original list
- foreach (Items item in duplicates)
- {
- items.Add(card);
- }
- // Print each item
- foreach (Items item in items)
- {
- Console.Write($"{item}, ");
- }
- //Output
- //"Apple, Orange, Apple, Orange, "
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement