简体   繁体   English

out in **out string [][] teams** 是什么意思

[英]what does out in **out string [][] teams** mean

what does out mean in a multidimensional param, if it's possible write an eg please, I'll really appreciate在多维参数是什么意思,如果可以写一个例如请,我真的很感激

public string GetTeamsInfo(out string[][] teams)
{
    ...
}

out means the parameter is an {out}put parameter out 表示参数是一个 {out}put 参数

opposed to the default input parameter (note: an input parameter is not the same as a parameter using the in modifier, that is an input only parameter and imposes it own requirements)与默认输入参数相反(注意:输入参数与使用in修饰符的参数不同,它是仅输入参数,并且有自己的要求)

this means it has no value at the beginning of the function and you need to assign one for it to be passed back to the calling code这意味着它在 function 的开头没有任何值,您需要分配一个以将其传递回调用代码

see https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/out-parameter-modifier请参阅https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/out-parameter-modifier

public string GetTeamsInfo(out string[][] teams)
{
    teams = new string[3][4];
    return "test";
}

string[][] teams;
//here teams is null
string text = GetTeamsInfo(out teams);
//here teams is a array of string[]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM