gpt4 book ai didi

c# - 如何从方法 C# 中获取字符串值

转载 作者:太空宇宙 更新时间:2023-11-03 23:41:39 24 4
gpt4 key购买 nike

<分区>

所以我正在尝试创建一个方法,其中将有一个字符串值,然后我想从主要方法中获取该值

public string test(string stringVar)
{
stringVar = "Hello world";
string anotherVar = stringVar;
return anotherVar;
}

例如,在这段代码中,我怎样才能让变量 'anotherVar' 在 main 方法中被识别?

谢谢。

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com