Complete the code to declare a variable of type string in C#.
string name = [1];In C#, string values must be enclosed in double quotes.
Complete the code to create a simple method that returns an integer in C#.
public int GetNumber() {
return [1];
}The method returns the integer 5 without quotes because quotes make it a string.
Fix the error in the code to correctly instantiate a List of strings in C#.
List<string> names = new [1]();To create a list of strings, use new List<string>().
Fill both blanks to create a dictionary with string keys and int values in C#.
Dictionary<[1], [2]> ages = new Dictionary<[1], [2]>();
Dictionaries need a key type and a value type. Here, keys are strings and values are integers.
Fill all three blanks to create a simple class with a property and a method in C#.
public class Person { public [1] Name { get; set; } public [2] Age { get; set; } public void [3]() { Console.WriteLine($"Name: {Name}, Age: {Age}"); } }
The class has a string property for Name, an int property for Age, and a method named Display to print info.