如何在c#中编写方法? [英] how to write method in c#?

查看:59
本文介绍了如何在c#中编写方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


< form action =" https://www.reddit.com/r/csharp/comments/6m0omw/how_to_write_method_in_c/#" class =" usertext warn-on-unload" ID = QUOT;形状t3_6m0omwxwn"风格= QUOT;余量:0像素;填充:0像素;字体大小:小;">



c#方法编写规则?告诉我所有方法结构规则?如何在c#中编写方法? get,set,... ??

< Access Specifier> <返回类型> <方法名称>(参数列表)
{
方法正文
}


为什么返回类型为空?返回类型可以是接口,类。为什么? 

解决方案

您应该首先阅读有关方法的Microsoft文档。


https://docs.microsoft.com/en-us/dotnet/csharp/programming -guide /类和 - 结构/方法


<form action="https://www.reddit.com/r/csharp/comments/6m0omw/how_to_write_method_in_c/#" class="usertext warn-on-unload" id="form-t3_6m0omwxwn" style="margin:0px;padding:0px;font-size:small;">

c# method writing rule? tell me all method struct rule? how to write method in c#? get, set, ...??

<Access Specifier> <Return Type> <Method Name>(Parameter List)
{
   Method Body
}

why return type is void? return type could be interface, class. why? 

解决方案

You should start by reading Microsoft documentation on methods.

https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/classes-and-structs/methods


这篇关于如何在c#中编写方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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