A method declares its parameter as `in int x`. What does that mean for the caller?
void Print(in int x) => Console.WriteLine(x);Read the full question →C# is the .NET language for services, desktop apps and games. Its interviews go deep on value versus reference semantics.
Structs versus classes, boxing, async and await state machines, LINQ deferred execution, IDisposable, and nullable reference types.
Where it shows up: Enterprise back ends on .NET, Unity game development, and Windows tooling.
Twenty real C# questions from the library, code snippet included. Nothing here is paraphrased for search engines. It is the same text a signed-in user sees.
void Print(in int x) => Console.WriteLine(x);Read the full question →try { DoWork(); }
catch (Exception ex)
{
Log(ex);
throw; // vs. throw ex;
}Read the full question →var nums = new[] { 1, 2, 3, 4 };
var result = nums.Where(n => n % 2 == 0).Select(n => n * 10);
Console.WriteLine(string.Join(",", result));Read the full question →int[] arr = { 1, 2, 3 };
int[] copy = arr;
copy[0] = 42;
Console.WriteLine(arr[0]);Read the full question →int? x = 5;
Console.WriteLine(x.GetType());Read the full question →var query = source.Where(x => x > 0).Select(x => Transform(x));
// query is never iteratedRead the full question →var n = 3.0;Read the full question →T First<T>(List<T> items) => items[0];
var nums = new List<int> { 10, 20, 30 };
var result = First(nums);Read the full question →class Res : IDisposable {
public void Dispose() => Console.Write("D");
}
using (var r = new Res()) {
Console.Write("B");
}
Console.Write("A");Read the full question →IQueryable<Order> q = db.Orders;
var result = q.Where(o => o.Total > 100)
.AsEnumerable()
.Where(o => o.Notes.Contains("urgent"))
.ToList();Read the full question →foreach (var item in collection) { /* ... */ }Read the full question →async Task<int> LoadAsync()
{
var data = await FetchAsync();
return data.Length;
}Read the full question →var value = null;Read the full question →async void Fire()
{
await Task.Delay(10);
throw new InvalidOperationException();
}Read the full question →var items = new List<string> { "a", "b" };
foreach (var item in items)
{
item = item.ToUpper();
}Read the full question →static void Print(IEnumerable<object> items) { }
List<string> names = new() { "a", "b" };
Print(names);Read the full question →double rate = 0.5;
Console.WriteLine($"{rate:P0}");Read the full question →using (var a = new Res("A"))
using (var b = new Res("B"))
{
// work
}Read the full question →var scores = new Dictionary<string, int>();
// ...Read the full question →int Run()
{
try
{
throw new InvalidOperationException();
}
catch (InvalidOperationException)
{
return 1;
}
finally
{
Console.WriteLine("cleanup");
}
}Read the full question →We keep the correct answer, the explanation and the scoring behind sign-in so the platform stays honest, which is why the answer options and the worked explanation for every C# question stay behind a free account. Signing in is free and takes a few seconds.
49 distinct C# topics are tagged across the library. These are the real topic labels stored on the questions, not a hand-written list.
…