Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace RemoveItemInList
- {
- class RemoveItemInList
- {
- static void Main()
- {
- List<string> SimpleNames = new List<string>();
- SimpleNames.Add("Steven");
- SimpleNames.Add("Jack");
- SimpleNames.Add("Daniel");
- SimpleNames.Add("Janet");
- SimpleNames.Add("Melinda");
- Console.WriteLine(string.Join(", ",SimpleNames));
- if (SimpleNames.Remove("Jack"))
- {
- Console.WriteLine("Jack was removed from list");
- }
- Console.WriteLine("Rest of the names are:");
- Console.WriteLine(string.Join(", ",SimpleNames));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment