fork download
  1. using System;
  2.  
  3. public class Test
  4. {
  5. readonly int a = 42;
  6. public static void Main()
  7. {
  8. new Test().a = 0;
  9. const int b = 88;
  10. b = 42;
  11. }
  12. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cs(8,14): error CS0191: A readonly field `Test.a' cannot be assigned to (except in a constructor or a variable initializer)
prog.cs(10,9): error CS0131: The left-hand side of an assignment must be a variable, a property or an indexer
Compilation failed: 2 error(s), 0 warnings
stdout
Standard output is empty