C# Exercises
Fill in the blanks to test your knowledge.
1
Print a line to the console
Console.("Hello C#");
2
Use var to declare an inferred variable
name = "Alice";
3
Create a generic List of strings
List<> names = new List<string>();
4
Add an item to a List
names.("Bob");
5
Use LINQ to filter a list
var adults = people.(p => p.Age >= 18);
6
Mark a method as asynchronous
public Task<string> FetchDataAsync() {
// body
}
7
Await an async call
var result = client.GetStringAsync(url);
8
Define a class with a public property
public class Person {
public string { get; set; }
}