我看到這樣寫的代碼:
static void Main(string[] args)
{
var name = GetInfo(); //this variable contains the method below
Console.Writeline(name)
}
static string GetInfo()
{
string name = "MyName";
return (name);
}
讓我們使用典型的盒子示例。里面的方法有什么好的例子?
換句話說,“價值”=“做某事的方法”是什么意思
uj5u.com熱心網友回復:
它沒有分配方法,它只是獲取該執行方法的結果。這樣你就可以重用GetInfo(); 在您需要此名稱的其他地方。
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/460298.html
上一篇:為什么給定常量和變數的位數不同?
下一篇:更新類變數的值-C
