我正在为一个学校项目创建一台自动售货机,当用户点击A1、A2、B1、B2等时,我必须更新数字。小数点后的所有内容都会更改,但小数之前的所有内容都不会更改。因此,如果我单击A1,它设置为4美元50美分,然后我选择D4,它是1美元5美分,我的JTextField显示为4美元5美分。 以下是GUI上的按钮: ? this is for buttons A and B for buttons C and D public void cost() { C_button.addActionListener (new ActionListener () {
p
我需要把一个Action<string>投给Action<object>。虽然这通常是类型不安全的,但在我的情况下,它总是用字符串调用的。我得到了一个错误:
Unable to cast object of type 'System.Action1[System.String]' to type 'System.Action1[System.Object
但是,我的问题是,由于Send()方法接受一个AirbrakeNotice对象,而我不能直接引用AirbrakeNotice对象,所以我需要以某种方式将Send()方法转换为Action<object><object> sendAction = (Action<object>)sendMethodDelegate;
'System.Action1[SharpBrake.Serialization.AirbrakeNotice]' to type