从方法返回 [英] Returns from a method
问题描述
原谅我,这可能是愚蠢的。我来自多年的视觉基础编程,并没有决定我想学习c#。我有什么似乎是一个简单的问题?我只是在玩简单的方法等,并希望简单地调用一个方法来生成,在这个例子中,
,单个字符串返回。我将字符串变量传递给我想要返回单个字符串的方法。即firstname,lastname to retrun fullname - firstname +" " +姓氏......我错过了什么... ????
{
课程计划
{
static void Main(string [] args)
{
您需要指定方法的返回类型:
private static 字符串 methodone(字符串名字,字符串姓氏)
Forgive me, this may be stupid. I come from many years of visual basic programming and have no decided I wish to learn c#. I have what seems to be a simple problem ?. I am just playing with simple methods etc and want to simply call a method to produce, in this example, a single string return. I am passing to string variables into a method which I want to return a single string. ie firstname, lastname to retrun fullname - firstname + " " + lastname……. what am I missing...????
{
class Program
{
static void Main(string[] args)
{
You need to specify the return type of the method:
private static string methodone(string firstname, string lastname)
这篇关于从方法返回的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!