377 questions for senior .NET engineer interviews, each with a 30-second answer, the full answer, a deep dive, the follow-ups interviewers ask next, and real-world production problems.
string and its immutability, StringBuilder, interpolation and formatting, culture-sensitive and ordinal comparison, interning, encoding and ReadOnlySpan of char.
The System.String type and its immutability: memory layout, what concatenation, Replace and ToUpper actually do, why immutability gives thread safety, hashing and security benefits, and its allocation cost.
String interning in .NET 10: the intern pool, automatic interning of literals and constant expressions, explicit string.Intern, reference equality surprises, memory lifetime, and safer alternatives such as custom string pools.
StringBuilder in .NET 10: when it beats concatenation and when it does not, its chunked internal buffer, capacity, interpolated Append, pooling, thread safety, and the alternatives for each text-building scenario.
String interpolation in C# 14: what $"..." compiles to, interpolated string handlers and their performance, alignment and format specifiers, culture rules, raw interpolated literals, and the SQL-injection and structured-logging traps.
String formatting in .NET 10: composite format items, standard and custom numeric and date format strings, IFormatProvider and CultureInfo (including en-AU), parsing with cultures, invariant globalisation mode, and span-based TryFormat.
Ordinal versus linguistic string comparison in .NET 10: how each works, which methods default to culture-sensitive comparison, case-insensitive comparison done right, the Turkish I problem, comparers for collections, and security implications.
A real-world culture-sensitive comparison scenario: NLS versus ICU, invariant globalisation mode in slim container images, IndexOf and sort-order changes, time zone ids, and how to make string behaviour deterministic across platforms.
Practical encoding work in .NET 10: Encoding APIs and defaults, BOMs, invalid-byte handling, Windows-1252 via CodePagesEncodingProvider, UTF-8 literals and the Utf8 class, Rune and StringInfo for user-visible characters, and normalisation for comparisons.
ReadOnlySpan<char> for zero-allocation text processing in .NET 10: slicing, span-based parsing and searching, splitting without substrings, stackalloc and ArrayPool buffers, alternate dictionary lookups, ref struct restrictions and ReadOnlyMemory.
A string-handling code review that combines the Phase 2 string topics: immutability, comparison, culture, formatting, concatenation, truncation, null handling and logging, with a rewritten version.