C#C
C#11mo ago
Big Chungus

Object passed by reference unexpectedly

Why is the context of a modified when context is modified?
c#
        TokenContext context = new TokenContext(0,1,0,0,src); // start = 0
        Token a = new Token(new SortedSet<int>{0,1}, new List<Token>{}, context);
        context.start = 1;
        context.end = 2;
        Token b = new Token(new SortedSet<int>{1,2}, new List<Token>{}, context);
        Console.WriteLine(a.context.start); // 1
        Console.WriteLine(b.context.start); // 1
Was this page helpful?