关于C#的几个问题,我不会这东西,但是需要这东西,谢谢啊

1、无法将 lambda 表达式 转换为类型“System.Delegate”,因为它不是委托类型

private static void show(object pComponet)
{
ExecutedInvokeHeandle method = null;
if ((pComponet != null) && (pComponet is Control))
{
mShowing = true;
if (method == null)
{
method = delegate {
if ((pComponet != null) && (pComponet is Control))
{
mWait.Show((pComponet as Control).FindForm());
(pComponet as Control).FindForm().FormClosed += new FormClosedEventHandler(WaitForm.WaitForm_FormClosed);
(pComponet as Control).FindForm().Activate();
}
else
{
mWait.TopMost = true;
mWait.Show();
}
};
}
(pComponet as Control).BeginInvoke(method);
mWaiting = true;
mEvents.WaitOne();
mWaiting = false;
(pComponet as Control).BeginInvoke(() => mWait.Close());
}
}
2、 类型“SerialClass.SerialClass”中不存在类型名称“SerialClass”
private void view_CheckButtonClick(object sender, EventArgs e)
{
Button button = sender as Button;
string[] strArray = this.dicButtons[button.Text].Split(new char[] { ',' });
new Dictionary();
string[] strArray2 = strArray[4].Split(new char[] { ';' });
SerialClass.SerialClass class2 = new SerialClass.SerialClass();
Application.DoEvents();
foreach (string str2 in strArray2)
{
Application.DoEvents();
string[] strArray3 = str2.Split(new char[] { '#' });
string str3 = this.iniFile.ReadString("DATA", strArray3[0], "");
if (str3 != "")
{
string[] strArray4 = str3.Split(new char[] { ',' });
class2.setSerialPort(strArray4[1], Convert.ToInt32(strArray4[2]), Convert.ToInt32(strArray4[4]), Convert.ToInt32(strArray4[6]));
class2.openPort();
byte[] receiveData = new byte[2];
if (strArray4[0] == "0")
{
class2.SendCommand(Encoding.ASCII.GetBytes(strArray4[3]), ref receiveData, Convert.ToInt32(strArray3[1]));
}
else
{
class2.SendCommand(strToToHexByte(strArray4[3]), ref receiveData, Convert.ToInt32(strArray3[1]));
}
class2.closePort();
}
}
this.OnPage(strArray[3]);
}
3、类型“SerialClass.SerialClass”中不存在类型名称“SerialClass”
private void btnDataTest_Click(object sender, EventArgs e)
{
SerialClass.SerialClass class2 = new SerialClass.SerialClass();
class2.setSerialPort(this.cbComPort.Text, Convert.ToInt32(this.cbRate.Text), Convert.ToInt32(this.cbDataBits.Text), Convert.ToInt32(this.cbStop.Text));
class2.openPort();
byte[] receiveData = new byte[2];
if (this.cbCode.SelectedIndex == 0)
{
class2.SendCommand(Encoding.ASCII.GetBytes(this.tbData.Text.Trim()), ref receiveData, 500);
}
else
{
class2.SendCommand(strToToHexByte(this.tbData.Text.Trim()), ref receiveData, 500);
}
class2.closePort();
}

c#
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!