fork(1) 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.Codigo = "Código";
  9. obj.Servico = "Serviço";
  10. obj.Quantidade = "Quantidade";
  11. obj.Preco = "Preço";
  12. var listServicos = new List<dynamic>{ obj };
  13. WriteLine(listServicos[0].Codigo);
  14. }
  15. }
  16.  
  17. //https://pt.stackoverflow.com/q/105776/101
Runtime error #stdin #stdout #stderr 0.26s 25580KB
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 () [0x00296] in <21d947cc410f46e5a0f095bf9c29f630>: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 () [0x00296] in <21d947cc410f46e5a0f095bf9c29f630>:0