提交 eb56e3fd 编写于 作者: F feilong

C#第2题

上级 0e90fe0c
{
"type": "code_options",
"author": "huanhuilong",
"source": "String.md"
}
\ No newline at end of file
# C# 字符串类型
以下使用 C# 字符串类型的语句,哪些都是对的?
一:
```csharp
Console.WriteLine("Hello, World!");
```
二:
```csharp
string helloworld1 = "Hello, World!";
Console.WriteLine(helloworld1);
```
三:
```csharp
String helloworld2 = "Hello, World!";
Console.WriteLine(helloworld2);
```
四:
```csharp
var helloworld3 = "Hello, World!";
Console.WriteLine(helloworld3);
```
五:
```csharp
string $helloworld4 = "Hello, World!";
Console.WriteLine($helloworld3);
```
六:
```csharp
string helloworld5 = 'Hello, World!';
Console.WriteLine($helloworld5);
```
七:
```csharp
var helloworld6;
helloworld6 = "Hello, World!";
Console.WriteLine(helloworld6);
```
## 答案
```csharp
一、二、三、四
```
## 选项
### A
```csahrp
一、二、三、五
```
### B
```csharp
一、二、四、六
```
### C
```csharp
一、三、四、七
```
### D
```csharp
三、四、五、七
```
### E
```csharp
二、四、五、六
```
......@@ -2,5 +2,7 @@
"node_id": "csharp-052799fae6c2498f9ef2966925377631",
"keywords": [],
"children": [],
"export": []
"export": [
"String.json"
]
}
\ No newline at end of file
// See https://aka.ms/new-console-template for more information
Console.WriteLine("Hello, World!");
string helloworld1 = "Hello, World!";
Console.WriteLine(helloworld1);
String helloworld2 = "Hello, World!";
Console.WriteLine(helloworld2);
var helloworld3 = "Hello, World!";
Console.WriteLine(helloworld3);
string $helloworld4 = "Hello, World!";
Console.WriteLine($helloworld3);
string helloworld5 = 'Hello, World!';
Console.WriteLine($helloworld5);
var helloworld6;
helloworld6 = "Hello, World!";
Console.WriteLine(helloworld6);
\ No newline at end of file
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册