fork download
  1. using System.Collections.Generic;
  2.  
  3. class Q6131171{
  4.  
  5. public static void Main(){
  6.  
  7. ushort a=0x0050;
  8. byte b = 0x00;
  9. byte c = 0xff;
  10. ushort d = 0x03ff;
  11. byte e = 0x00;
  12. ushort f = 0x000c;
  13.  
  14. List<List<byte>> x = new List<List<byte>>();
  15. x.Add(new List<byte>(System.BitConverter.GetBytes(a)));
  16. x.Add(new List<byte>(new byte[]{b}));
  17. x.Add(new List<byte>(new byte[]{c}));
  18. x.Add(new List<byte>(System.BitConverter.GetBytes(d)));
  19. x.Add(new List<byte>(new byte[]{e}));
  20. x.Add(new List<byte>(System.BitConverter.GetBytes(f)));
  21.  
  22. x = x.ConvertAll(delegate(List<byte> list){
  23. if(!System.BitConverter.IsLittleEndian){
  24. list.Reverse();
  25. }
  26. return list;
  27. }
  28. );
  29.  
  30. List<byte> y = new List<byte>();
  31. x.ForEach(delegate(List<byte> list){ y.AddRange(list); });
  32.  
  33. y.ForEach(delegate(byte b1){ System.Console.WriteLine(System.String.Format("{0:x2}",b1));});
  34.  
  35. }
  36. }
Success #stdin #stdout 0.1s 13496KB
stdin
Standard input is empty
stdout
50
00
00
ff
ff
03
00
0c
00