C# APIs Flashcards
Determine the length of a List<>
List.Count() does not modify
Add ab item to the end of a List<>
List.Add() in place modification, does not return
index the i’th element of a List
List[i] returns the value but also allows modification or List.ElementAt(i) returns the value
Remove element from List at i
List().RemoveAt(i), in place modification
Reverse a List
List.Reverse() in place modification, returns void
Given a List, merge all of the string elements into a single string
String.Join(“ “, List())
Copy a List to a new T[]
List.ToArray()
Given List, find the first occurrence of someT, start searching at index idx
List.IndexOf(someT, idx)
Given List append another List to the end of it
List.Append(List otherList)
Given Dictionary, determine if the key someKey exists
Dictionary.ContainsKey(someKey)
Given Dictionary determine if someValue exists
Dictionary.ContainsValue(someValue)
Return all of the keys in a dictionary as an IEnumerable
Dictionary.Keys
Loop over all of the keys in a Dictionary
foreach (int key in Dictionary.Keys)
Given a String, replace all instances of char1 with char2
String.Replace(char1, char2)
Given a String, replace all instances of string1 with string2
String.Replace(string1, string2)