fork download
  1. using static System.Console;
  2. using System.Dynamic;
  3. using System.Collections.Generic;
  4.  
  5. public class Program {
  6. public static void Main() {
  7. dynamic obj = new ExpandoObject();
  8. obj.cor = "verde";
  9. obj.tamanho = 2000;
  10. WriteLine(obj.cor);
  11. WriteLine(obj.tamanho);
  12. var obj2 = (IDictionary<string,object>)obj;
  13. WriteLine(obj2["cor"]);
  14. WriteLine(obj2["tamanho"]);
  15. }
  16. }
Runtime error #stdin #stdout #stderr 0.18s 24064KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
Unhandled Exception:
Microsoft.CSharp.RuntimeBinder.RuntimeBinderException: 'Program' does not contain a definition for 'WriteLine'
  at (wrapper dynamic-method) System.Object.CallSite.Target(System.Runtime.CompilerServices.Closure,System.Runtime.CompilerServices.CallSite,System.Type,object)
  at System.Dynamic.UpdateDelegates.UpdateAndExecuteVoid2[T0,T1] (System.Runtime.CompilerServices.CallSite site, T0 arg0, T1 arg1) [0x00113] in <35ad2ebb203f4577b22a9d30eca3ec1f>:0 
  at Program.Main () [0x00170] in <67c6129fb06841ef81ef9eb1d9861f7a>:0 
[ERROR] FATAL UNHANDLED EXCEPTION: Microsoft.CSharp.RuntimeBinder.RuntimeBinderException: 'Program' does not contain a definition for 'WriteLine'
  at (wrapper dynamic-method) System.Object.CallSite.Target(System.Runtime.CompilerServices.Closure,System.Runtime.CompilerServices.CallSite,System.Type,object)
  at System.Dynamic.UpdateDelegates.UpdateAndExecuteVoid2[T0,T1] (System.Runtime.CompilerServices.CallSite site, T0 arg0, T1 arg1) [0x00113] in <35ad2ebb203f4577b22a9d30eca3ec1f>:0 
  at Program.Main () [0x00170] in <67c6129fb06841ef81ef9eb1d9861f7a>:0