fork download
  1. using static System.Console;
  2. using System.Dynamic;
  3.  
  4. public class Program {
  5. public static void Main() {
  6. dynamic obj = new ExpandoObject();
  7. obj.propriedade1 = "valor1";
  8. obj.propriedade2 = "valor2";
  9. WriteLine(obj.propriedade1);
  10. WriteLine(obj.propriedade2);
  11. }
  12. }
  13.  
  14. //https://pt.stackoverflow.com/q/68085/101
Runtime error #stdin #stdout #stderr 0.25s 24280KB
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 <75880421838f42f7950e9ce59e12e479>: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 <75880421838f42f7950e9ce59e12e479>:0