mirror of
https://bitbucket.org/Mattrixwv/cstutorials.git
synced 2025-12-06 18:34:03 -05:00
27 lines
660 B
C#
27 lines
660 B
C#
//C#/Tutorials/HelloWorld.cs
|
|
//Matthew Ellison
|
|
// Created: 07-29-20
|
|
//Modified: 07-29-20
|
|
//This shows some basic list operations
|
|
|
|
|
|
using System;
|
|
|
|
|
|
namespace mee{
|
|
public class Lists{
|
|
public static Main(string[] args){
|
|
List<string> names = new List<string> { "Matthew", "Ana", "Felipe", "Maria", "Bill"};
|
|
names.Remove("Ana");
|
|
names.Add("Felipe");
|
|
foreach(string name in names){
|
|
Console.WriteLine($"{name}");
|
|
}
|
|
int location = names.IndexOf("Felipe");
|
|
Console.WriteLine($"location = {location}");
|
|
location = names.IndexOf("Bob");
|
|
Console.WriteLine($"location = {location}");
|
|
Console.WriteLine($"size = {names.Count}");
|
|
}
|
|
}
|
|
} |