C#从另一个void返回字符串 [英] C# return a string from another void
本文介绍了C#从另一个void返回字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我很确定这是一件容易的事.我只想从另一个void返回一个字符串.
I'm pretty sure this is an easy one. I simply want to return a string from another void.
public static void LinkWorker(string baseURLString)
{
// do some stuff here
HTMLWork(baseURLStringCycle)
--> this is where i need xstring returned
foreach(string xyString in xstring.split('\n'))
{
}
}
public static void HTMLWork(string baseURLStringCycle)
{
//do HTML work here
// create x string
string xString = ; //the result of the htmlwork
}
推荐答案
您不希望使用 void
方法,而需要返回类型为 string
的方法.
You do not want a void
method, you want a method returning type string
.
public static string HTMLWork(string baseURLStringCycle)
{
//...
return xString;
}
这篇关于C#从另一个void返回字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文