{
  "schemaVersion": "0.11.0",
  "canonical": "https://www.pystone.net/notes/csharp-static-instance-singleton/",
  "atlas": "https://www.pystone.net/?node=csharp-static-instance-singleton#knowledge-atlas",
  "markdown": "https://www.pystone.net/notes/csharp-static-instance-singleton.md",
  "context": "https://www.pystone.net/notes/csharp-static-instance-singleton.context.json",
  "knowledgeVersion": "224c990773de.5fa8af6e39fa",
  "build": {
    "siteCommit": "224c990773de166d23a886306577dd90379529ce",
    "notesCommit": "5fa8af6e39fa3891d1b9b4832bfa6c4e0ecaaf0a",
    "builtAt": "1970-01-01T00:00:00.000Z",
    "version": "224c990773de.5fa8af6e39fa"
  },
  "id": "note:csharp-static-instance-singleton",
  "slug": "csharp-static-instance-singleton",
  "title": "静态的实例【单例模式中】",
  "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": "静态的实例【单例模式中】",
  "contentRole": "unspecified",
  "isMoc": false,
  "mocRecognition": "none",
  "generated": false,
  "attribution": "unspecified",
  "domain": "10-计算机、信息技术与工程",
  "tags": [],
  "mocs": [],
  "contentHash": "4da95764973558a7dcba47ed9d1e4dd8961788dbfc8a69618e299a54f15d8d6c",
  "assets": [],
  "headings": [
    {
      "depth": 1,
      "text": "静态的实例【单例模式中】",
      "anchor": "静态的实例单例模式中",
      "citation": "https://www.pystone.net/notes/csharp-static-instance-singleton/#%E9%9D%99%E6%80%81%E7%9A%84%E5%AE%9E%E4%BE%8B%E5%8D%95%E4%BE%8B%E6%A8%A1%E5%BC%8F%E4%B8%AD"
    }
  ],
  "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中的“静态的实例【单例模式中】”导航项",
      "citation": "https://www.pystone.net/notes/programming-languages-and-runtimes/#net%E4%B8%8Ecsharp"
    }
  ],
  "contentMarkdown": "# 静态的实例【单例模式中】\n\n﻿# 静态的实例【单例模式中】\n\n> 创建时间：2020/9/14 14:39\n\n静态的实例可以作为静态函数和动态函数之间的桥梁。\n\n静态函数不能调用动态函数，因此，如果想用静态函数调用动态函数，就可以使用静态的实例（单例模式中的Instance）。\n\n静态函数不能直接调用动态函数的原因是：静态函数可以在类实例化之前调用，而此时，无法确定类是否被实例化。动态函数是类的动态实例才有的成员，静态语句没有直接访问动态函数的途径。\n\n如果写一个静态的实例，就可以保证类在被静态地访问到时，就已经有一份实例，可以访问到动态函数。\n"
}
