fork(2) download
  1. using System;
  2. using System.Text;
  3. using System.Linq;
  4. using System.Collections.Generic;
  5. using System.Reflection;
  6.  
  7. public class Program
  8. {
  9. public static void Main(string[] args)
  10. {
  11. string test = "ABC";
  12. Type t = test.GetType();
  13. var indexer = t.GetProperties()
  14. .Where(p => p.GetIndexParameters().Length != 0)
  15. .FirstOrDefault();
  16. if (indexer != null)
  17. {
  18. object[] indexArgs = { 1 };
  19. var secondChar = indexer.GetValue(test, indexArgs);
  20. Console.Write(secondChar);
  21. }
  22. }
  23. }
Success #stdin #stdout 0.03s 34920KB
stdin
Standard input is empty
stdout
B