Skip to content

Instantly share code, notes, and snippets.

@jhgbrt
jhgbrt / code-quiz-001.cs
Last active May 22, 2017 16:11
Which values can the variable 'x' have in the code below, and why? Hint: compile in release mode if you want to try it...
using System;
using System.Threading.Tasks;
namespace CodeQuiz
{
class Program
{
static void Main()
{
ulong sharedValue = 0;
using System.Collections.Generic;
using System.Linq;
namespace System.Collections.Immutable
{
public class ImmutableListWithValueSemantics<T> : IImmutableList<T>, IEquatable<IImmutableList<T>>
{
IImmutableList<T> _list;
public ImmutableListWithValueSemantics(IImmutableList<T> list) => _list = list;
var output = $"FOO {nameof(R)} BAR " + $" {f(nameof(R))} BAZ ";
Console.WriteLine(output);
string f(string s) => s;
public class R
{
}
// when compiled as a net6 console app in VS2022 preview 3.1, the above code produces an unexpected result
using iText.Kernel.Pdf;
using iText.Kernel.Pdf.Canvas.Parser;
using iText.Kernel.Pdf.Canvas.Parser.Listener;
using Net.Code.Csv;
using System.Globalization;
using System.Text.RegularExpressions;
var folder = args[0];