您能举一个调用函数和被调用函数的例子吗 [英] can u give me example on calling function and called function

查看:124
本文介绍了您能举一个调用函数和被调用函数的例子吗的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您能举一个调用函数和调用函数的例子吗?

can u give me example on calling function and called function

推荐答案

简单:

调用函数:

int res = Calc(a,b);

调用函数:

public int Calc(int a,int b)
{
返回a + b;
}
Simple:

Calling function:

int res = Calc(a, b);

Called Function:

public int Calc(int a, int b)
{
return a + b;
}


私有无效Form2_Load(对象发送者,EventArgs e)
{
MsgBox();
}

私人void MsgBox()
{
MessageBox.Show("Test");
}
private void Form2_Load(object sender, EventArgs e)
{
MsgBox();
}

private void MsgBox()
{
MessageBox.Show("Test");
}


如果您需要了解什么是C#中的函数/方法以及如何调用方法,请检查此^ ]

我正在添加与C#方法相关的另一资源.选中 [ C#中的匿名函数 [
If you need to know about what is function/method in C# and how to call a method check this tutorial[^]

I''m adding another resource related to C# methods. Check this[^]

And it is better if you can read about Anonymous Functions in C#[^]


这篇关于您能举一个调用函数和被调用函数的例子吗的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆