String.md 981 字节
Newer Older
F
feilong 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
# 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
二、四、五、六
```