out ref 作為函數(shù)的參數(shù)
ref -----雙向傳遞 數(shù)據(jù) ----必須是instance 好的
out ----- 只是出來不進(jìn)去的 , 給個引用就可以了
a 作為ref的 傳遞進(jìn)去必須先要初始化一個 instance 的空間
否則編譯出錯。












out 變量
string str1 ="U ---"; // out 作為 out 只需要定義一個引用
在外面調(diào)用的地方即使 給了實例 ,進(jìn)入到函數(shù)體里面也不能用。所以只需要引用就可以了。
max ( ref a ,ref b , out str1 , out j );
static void max( ref string x, ref string y , out string a , out int b ) {
string o = null;
a = a+ "max"; // Test.cs(37,23): //error error CS0269: 使用了未賦值的 out 參數(shù)“a”