位置:首頁 > 軟件操作教程 > 編程開發(fā) > C# > 問題詳情

C#將對(duì)象作為參數(shù)傳遞到其他方法

提問人:劉冬梅發(fā)布時(shí)間:2020-10-13

public class Test1

{

    public string str = "aaa";

    public void f(Test1 test)

    {

        str = "bbb";

        Console.WriteLine(test.str);

    }

    public void f1()

    {

        f(this);

    }


    public static void Main()

    {

        Test1 test = new Test1();

        test.f1();

    }

}

繼續(xù)查找其他問題的答案?

相關(guān)視頻回答
回復(fù)(0)
返回頂部