---
title: "复合格式字符串与字符串内插"
author: "Perrin Yong"
author_profile: https://www.pystone.net/profile/
published_by: "Perrin Yong"
canonical: https://www.pystone.net/notes/csharp-composite-format-string-interpolation/
type: note
content_role: unspecified
visibility: public
id_stability: rename-stable
source_path: "10-计算机、信息技术与工程/02-编程语言与运行时/.NET与CSharp/复合格式字符串与字符串内插.md"
content_hash: 6872e1b2611e7dd269553fd45e5846dce7dd6bdb074f1ef455738987657acff1
knowledge_version: 224c990773de.5fa8af6e39fa
site_commit: 224c990773de166d23a886306577dd90379529ce
notes_commit: 5fa8af6e39fa3891d1b9b4832bfa6c4e0ecaaf0a
---
# 复合格式字符串与字符串内插

﻿# 复合格式字符串与字符串内插

> 创建时间：2020/6/8 10:36

## 复合格式字符串

{ index[,alignment][:formatString]}

```csharp
string str1 = &quot;test&quot;;
string str2 = &quot;test&quot;;

```
```csharp
string str1 = &quot;test&quot;;
string str2 = &quot;test&quot;;

```

## 字符串内插

```csharp
string str1 = &quot;test&quot;;
string str2 = &quot;test&quot;;

```
