开发者

C# Calling a function?

Hi i'm getting this error, do I have to add a special namespace? "The type or namespace name 'call' could not be found...开发者_开发百科"

private void start_btn_Click(object sender, EventArgs e)
{
    call DoIt();

}

void DoIt() 
{
    ...code
}


Just invoke DoIt directly without call. There is no such operation as call in C#

DoIt();


One doesn't use call to invoke a function in C#, so fix your code thus:

private void start_btn_Click(object sender, EventArgs e)
{
    DoIt();
}

As @Kheldar has suggested, you're probably thinking of the call statement in Visual Basic, which isn't a feature of C#.


Remove "call" and your code will run.

VB6 or Windows Script coder much? ;)


Remove call in your snippet, in C# does not exist such kind of keyword. DoIt(); will execute your function pretty well.

Anyway, I think you might want to read something like:

  • MSDN C# Tutorial;
  • Best .NET C# Books;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜