Created
April 5, 2022 10:16
-
-
Save MP-C/9c8cbb3f8eb8a7b7e3488b6dda2a9d40 to your computer and use it in GitHub Desktop.
1. List<T>
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; // list and vectors | |
namespace ConsoleApp1 | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
List<string> stringCharacteres = new List<string>(); | |
stringCharacteres.Add("Name: Mario"); | |
stringCharacteres.Add("Family name: Carvalho"); | |
stringCharacteres.Add("Age: 34"); | |
int countStringChar = stringCharacteres.Count; | |
stringCharacteres.ForEach(num => Console.WriteLine(num + ", ")); | |
Console.WriteLine("Count After Add " + countStringChar); | |
Console.WriteLine("\n"); | |
stringCharacteres.RemoveAt(0); | |
Console.WriteLine("String After RemoveAt(0) "); | |
stringCharacteres.ForEach(num => Console.WriteLine(num + ", ")); | |
Console.WriteLine("\n"); | |
stringCharacteres.Remove("Age: 34"); | |
Console.WriteLine("After Remove('Age: 34')"); | |
stringCharacteres.ForEach(num => Console.WriteLine(num + ", ")); | |
int countStringChar2 = stringCharacteres.Count; | |
Console.WriteLine("Count After Remove('Age: 34')"); | |
Console.WriteLine("Count After Add " + countStringChar2) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment