这个C#代码是如何工作的(在aspx.cs类中)

时间:2013-02-25 16:06:33

标签: c# asp.net

我对以下代码感到困惑,看起来它在这里被禁用了?

    public bool GetFormsCredentials(out Cookie authCookie, out string userName, out string password, out string authority) {
        authCookie = null;
        userName = password = authority = null;
        return false;
    }

不应该看起来像这样吗?

userName =  myName
password =  12345
authority = someAuthority

1 个答案:

答案 0 :(得分:1)

在C#赋值操作中,“=”返回赋值,因此上面的代码如下所示:

userName = (password = (authority = null));

authority = null;
password = authority;
userName = password;