<input type="hidden" value="@ViewData["LoginProvider"]?.ToString() ?? null" />
When the ViewData
is null, it makes a half-conversion
and the hidden field contains value: ?.ToString() ?? null
I'm sure that I've enabled C# 6:
<compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:6 /nowarn:1659;1699;1701">
<providerOption name="CompilerVersion" value="v4.0" />
</compiler>
Why?
In C programming language, %d and %i are format specifiers as where %d specifies the type of variable as decimal and %i specifies the type as integer. In usage terms, there is no difference in printf() function output while printing a number using %d or %i but using scanf the difference occurs.
C programming language is a machine-independent programming language that is mainly used to create many types of applications and operating systems such as Windows, and other complicated programs such as the Oracle database, Git, Python interpreter, and games and is considered a programming foundation in the process of ...
What is C? C is a general-purpose programming language created by Dennis Ritchie at the Bell Laboratories in 1972. It is a very popular language, despite being old. C is strongly associated with UNIX, as it was developed to write the UNIX operating system.
Compared to other languages—like Java, PHP, or C#—C is a relatively simple language to learn for anyone just starting to learn computer programming because of its limited number of keywords.
There is a problem with the ?? operator, the left hand value is string and the right hand value is null, therefore, it is not a correct syntax. Also, since there is an assignment operation involved, you need to wrap them in parenthesis.
You can try the following:
<input type="hidden" value="@(ViewData["LoginProvider"]?.ToString() ?? "")" />
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With