fork download
  1. private void TextBoxAvgSet_TextChanged(object sender, EventArgs e)
  2. {
  3. Setter<int>(sender as TextBox, new IntPtrVoid(camera.Average),
  4. new VoidPtrInt(camera.Average), "Average", cameraControlGUI.LabelAvgShow);
  5. }
  6.  
  7. private void Setter<InType>(TextBox sender, Delegate output, Delegate input, string str, Label shower)
  8. {
  9. string text = sender.Text;
  10.  
  11. if (text.Contains("\r\n"))
  12. {
  13. sender.Text = text = text.Replace("\r\n", "");
  14. var converter = TypeDescriptor.GetConverter(typeof(InType));
  15. try
  16. {
  17. var value = (InType)converter.ConvertFromString(text);
  18. input.DynamicInvoke(value);
  19. if (!EqualityComparer<InType>.Default.Equals(value, (InType)output.DynamicInvoke()))
  20. {
  21. cameraControlGUI.LabelErrorCodeShow.Text = "無法設定" + str + ",將設定改回預設值";
  22. sender.Text = Convert.ToString(output.DynamicInvoke());
  23. }
  24. shower.Text = Convert.ToString(output.DynamicInvoke());
  25. }
  26. catch (NotSupportedException exception)
  27. {
  28. cameraControlGUI.LabelErrorCodeShow.Text = exception.ToString();
  29. }
  30. catch (Exception exception)
  31. {
  32. cameraControlGUI.LabelErrorCodeShow.Text = exception.ToString();
  33. }
  34. }
  35. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cs(1,16): error CS1525: Unexpected symbol `void', expecting `class', `delegate', `enum', `interface', `partial', or `struct'
Compilation failed: 1 error(s), 0 warnings
stdout
Standard output is empty