What do two question marks together mean in C#?

前端 未结 18 1349
借酒劲吻你
借酒劲吻你 2020-11-22 03:41

Ran across this line of code:

FormsAuth = formsAuth ?? new FormsAuthenticationWrapper();

What do the two question marks mean, is it some ki

18条回答
  •  一个人的身影
    2020-11-22 04:25

    Nothing dangerous about this. In fact, it is beautiful. You can add default value if that is desirable, for example:

    CODE

    int x = x1 ?? x2 ?? x3 ?? x4 ?? 0;
    

提交回复
热议问题