{
  "schemaVersion": "0.11.0",
  "canonical": "https://www.pystone.net/notes/csharp-string-concat-performance-comparison/",
  "atlas": "https://www.pystone.net/?node=csharp-string-concat-performance-comparison#knowledge-atlas",
  "markdown": "https://www.pystone.net/notes/csharp-string-concat-performance-comparison.md",
  "context": "https://www.pystone.net/notes/csharp-string-concat-performance-comparison.context.json",
  "knowledgeVersion": "224c990773de.5fa8af6e39fa",
  "build": {
    "siteCommit": "224c990773de166d23a886306577dd90379529ce",
    "notesCommit": "5fa8af6e39fa3891d1b9b4832bfa6c4e0ecaaf0a",
    "builtAt": "1970-01-01T00:00:00.000Z",
    "version": "224c990773de.5fa8af6e39fa"
  },
  "id": "note:csharp-string-concat-performance-comparison",
  "slug": "csharp-string-concat-performance-comparison",
  "title": "几种String拼接方式性能对比",
  "type": "note",
  "visibility": "public",
  "idStability": "rename-stable",
  "author": {
    "name": "Perrin Yong",
    "profile": "https://www.pystone.net/profile/"
  },
  "publisher": {
    "name": "Perrin Yong",
    "profile": "https://www.pystone.net/profile/"
  },
  "aliases": [],
  "summary": "几种String拼接方式性能对比",
  "contentRole": "unspecified",
  "isMoc": false,
  "mocRecognition": "none",
  "generated": false,
  "attribution": "unspecified",
  "domain": "10-计算机、信息技术与工程",
  "tags": [],
  "mocs": [],
  "contentHash": "aa73950f0e1c5f73932d550f76879bad442ded9d8989386ba366ee66a9bf6fa5",
  "assets": [
    {
      "reference": "assets/0024 - 几种String拼接方式性能对比__resource-001-cd046ea0b011.png",
      "url": "/media/96a5f67ffbc50ebd310d.png",
      "mediaType": "image/png",
      "contentHash": "96a5f67ffbc50ebd310d73632b964f259bdb866c8707df12fab417cf6d29b35b",
      "byteLength": 13993,
      "width": 422,
      "height": 202
    }
  ],
  "headings": [
    {
      "depth": 1,
      "text": "几种String拼接方式性能对比",
      "anchor": "几种string拼接方式性能对比",
      "citation": "https://www.pystone.net/notes/csharp-string-concat-performance-comparison/#%E5%87%A0%E7%A7%8Dstring%E6%8B%BC%E6%8E%A5%E6%96%B9%E5%BC%8F%E6%80%A7%E8%83%BD%E5%AF%B9%E6%AF%94"
    },
    {
      "depth": 2,
      "text": "几种String拼接方式性能对比",
      "anchor": "几种string拼接方式性能对比-1",
      "citation": "https://www.pystone.net/notes/csharp-string-concat-performance-comparison/#%E5%87%A0%E7%A7%8Dstring%E6%8B%BC%E6%8E%A5%E6%96%B9%E5%BC%8F%E6%80%A7%E8%83%BD%E5%AF%B9%E6%AF%94-1"
    }
  ],
  "claims": [],
  "outgoing": [],
  "incoming": [
    {
      "id": "note:programming-languages-and-runtimes",
      "title": "编程语言与运行时",
      "url": "https://www.pystone.net/notes/programming-languages-and-runtimes/",
      "atlas": "https://www.pystone.net/?node=programming-languages-and-runtimes#knowledge-atlas",
      "label": "编程语言与运行时",
      "origin": "explicit",
      "humanReviewed": true,
      "context": ".NET与CSharp中的“几种String拼接方式性能对比”导航项",
      "citation": "https://www.pystone.net/notes/programming-languages-and-runtimes/#net%E4%B8%8Ecsharp"
    }
  ],
  "contentMarkdown": "# 几种String拼接方式性能对比\n\n﻿# 几种String拼接方式性能对比\n\n> 创建时间：2021/12/10 11:47\n\n* 几种String拼接方式性能对比\n\n## 几种String拼接方式性能对比\n\n```csharp\nstring str1 = &quot;test&quot;;\nstring str2 = &quot;test&quot;;\n\n```\n\n![](assets/0024 - 几种String拼接方式性能对比__resource-001-cd046ea0b011.png)\n\n使用C#原生的System.Text中的接口：\n\n`$\"{x}:{y}\"` 性能最差\n\nstring.Concat与string.Format 性能相似\n\n复用StringBuilder的方式性能较高\n\nZstring的几种方式性能都最好，且堆内存分配量相同。\n"
}
