fix(guide) Replace invalid prism code block names (#35961)
* fix: replace sh with shell fix replace terminal with shell fix replace node with js fix replace output with shell fix replace cs with csharp fix replace c++ with cpp fix replace c# with csharp fix replace javasctipt with js fix replace syntax with js fix replace unix with shell fix replace linux with shell fix replace java 8 with java fix replace swift4 with swift fix replace react.js with jsx fix replace javascriot with js fix replace javacsript with js fix replace c++ - with cpp fix: corrected various typos fix: replace Algorithm with nothing fix: replace xaml with xml fix: replace solidity with nothing fix: replace c++ with cpp fix: replace txt with shell fix: replace code with json and css fix: replace console with shell
This commit is contained in:
committed by
Oliver Eyton-Williams
parent
4b4762716c
commit
0a1eeea424
@@ -10,7 +10,7 @@ localeTitle: Оператор Null-coalescing
|
||||
|
||||
Поскольку `name` равно `null` , `clientName` будет присвоено значение «John Doe».
|
||||
|
||||
```cs
|
||||
```csharp
|
||||
string name = null;
|
||||
|
||||
string clientName = name ?? "John Doe";
|
||||
@@ -18,7 +18,7 @@ string name = null;
|
||||
Console.WriteLine(clientName);
|
||||
```
|
||||
|
||||
```cs
|
||||
```csharp
|
||||
> John Doe
|
||||
```
|
||||
|
||||
@@ -26,7 +26,7 @@ string name = null;
|
||||
|
||||
Поскольку `name` не равно `null` , `clientName` будет присвоено значение `name` , которое является «Jane Smith».
|
||||
|
||||
```cs
|
||||
```csharp
|
||||
string name = "Jane Smith";
|
||||
|
||||
string clientName = name ?? "John Doe";
|
||||
@@ -34,7 +34,7 @@ string name = "Jane Smith";
|
||||
Console.WriteLine(clientName);
|
||||
```
|
||||
|
||||
```cs
|
||||
```csharp
|
||||
> Jane Smith
|
||||
```
|
||||
|
||||
@@ -42,7 +42,7 @@ string name = "Jane Smith";
|
||||
|
||||
Вы можете использовать оператор `if...else` для проверки наличия `null` и назначения другого значения.
|
||||
|
||||
```cs
|
||||
```csharp
|
||||
string clientName;
|
||||
|
||||
if (name != null)
|
||||
@@ -53,7 +53,7 @@ string clientName;
|
||||
|
||||
Однако это может быть значительно упрощено с помощью оператора нулевой коалесценции.
|
||||
|
||||
```cs
|
||||
```csharp
|
||||
string clientName = name ?? "John Doe";
|
||||
```
|
||||
|
||||
@@ -61,13 +61,13 @@ string clientName = name ?? "John Doe";
|
||||
|
||||
Также можно использовать условный оператор для проверки наличия `null` и присвоения другого значения.
|
||||
|
||||
```cs
|
||||
```csharp
|
||||
string clientName = name != null ? name : "John Doe";
|
||||
```
|
||||
|
||||
Опять же, это можно упростить с помощью оператора нуль-коалесценции.
|
||||
|
||||
```cs
|
||||
```csharp
|
||||
string clientName = name ?? "John Doe";
|
||||
```
|
||||
|
||||
|
Reference in New Issue
Block a user