{"id":50214,"date":"2025-07-30T22:11:33","date_gmt":"2025-07-30T14:11:33","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/50214.html"},"modified":"2025-07-30T22:11:33","modified_gmt":"2025-07-30T14:11:33","slug":"c%e4%b8%8ec%e4%ba%92%e6%93%8d%e4%bd%9c%e7%a4%ba%e4%be%8b","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/50214.html","title":{"rendered":"C#\u4e0eC++\u4e92\u64cd\u4f5c\u793a\u4f8b"},"content":{"rendered":"<h3>C# \u4e0e C&#043;&#043; \u4e92\u64cd\u4f5c\u6df1\u5ea6\u89e3\u6790&#xff1a;\u56db\u79cd\u5173\u952e\u6280\u672f\u5b9e\u8df5<\/h3>\n<p>C# \u548c C&#043;&#043; \u7684\u534f\u540c\u5f00\u53d1\u662f\u73b0\u4ee3\u8f6f\u4ef6\u5de5\u7a0b\u4e2d\u7684\u5e38\u89c1\u9700\u6c42\u2014\u2014\u901a\u8fc7\u4e92\u64cd\u4f5c\u6280\u672f&#xff0c;\u6211\u4eec\u65e2\u80fd\u4fdd\u7559 C&#043;&#043; \u7684\u9ad8\u6027\u80fd\u4e0e\u786c\u4ef6\u7ea7\u63a7\u5236\u80fd\u529b&#xff0c;\u53c8\u80fd\u4eab\u53d7 C# \u7684\u5f00\u53d1\u6548\u7387\u548c\u5f3a\u5927\u7684\u751f\u6001\u652f\u6301\u3002\u4e0b\u9762\u4ecb\u7ecd\u56db\u79cd\u6838\u5fc3\u4e92\u64cd\u4f5c\u6280\u672f\u53ca\u5176\u4ee3\u7801\u5b9e\u73b0&#xff1a;<\/p>\n<hr \/>\n<h4>\u200b\u200b\u4e00\u3001\u5e73\u53f0\u8c03\u7528 (P\/Invoke) &#8211; \u8c03\u7528 C&#043;&#043; \u539f\u751f\u51fd\u6570\u200b\u200b<\/h4>\n<p>\u200b\u200b\u9002\u7528\u573a\u666f\u200b\u200b&#xff1a;\u76f4\u63a5\u8c03\u7528\u73b0\u6709 DLL \u4e2d\u7684 C&#043;&#043; \u51fd\u6570<\/p>\n<p>\/\/ C# \u8c03\u7528\u65b9<br \/>\nusing System;<br \/>\nusing System.Runtime.InteropServices;<\/p>\n<p>class InteropDemo<br \/>\n{<br \/>\n    \/\/ \u58f0\u660e C&#043;&#043; \u51fd\u6570&#xff08;\u7ea6\u5b9a\u4f7f\u7528 cdecl \u8c03\u7528\u89c4\u8303&#xff09;<br \/>\n    [DllImport(&#034;NativeLib.dll&#034;, CallingConvention &#061; CallingConvention.Cdecl)]<br \/>\n    private static extern int AddNumbers(int a, int b);<\/p>\n<p>    [DllImport(&#034;NativeLib.dll&#034;, CharSet &#061; CharSet.Ansi)]<br \/>\n    private static extern void PrintMessage(string text);<\/p>\n<p>    public static void Main()<br \/>\n    {<br \/>\n        int sum &#061; AddNumbers(15, 27);  \/\/ \u8c03\u7528 C&#043;&#043; \u52a0\u6cd5\u51fd\u6570<br \/>\n        Console.WriteLine($&#034;Sum from C&#043;&#043;: {sum}&#034;);<\/p>\n<p>        PrintMessage(&#034;Hello from C#!&#034;);  \/\/ \u4f20\u9012\u5b57\u7b26\u4e32\u5230 C&#043;&#043;<br \/>\n    }<br \/>\n}<\/p>\n<p>\u5bf9\u5e94\u7684 C&#043;&#043; \u5b9e\u73b0 (NativeLib.cpp)&#xff1a;<\/p>\n<p>#include &lt;iostream&gt;<\/p>\n<p>extern &#034;C&#034; __declspec(dllexport)<br \/>\nint AddNumbers(int a, int b) {<br \/>\n    return a &#043; b;<br \/>\n}<\/p>\n<p>extern &#034;C&#034; __declspec(dllexport)<br \/>\nvoid PrintMessage(const char* text) {<br \/>\n    std::cout &lt;&lt; &#034;C&#043;&#043; Received: &#034; &lt;&lt; text &lt;&lt; std::endl;<br \/>\n}<\/p>\n<p>\u5173\u952e\u6280\u672f\u70b9\u200b\u200b&#xff1a;<\/p>\n<li>extern &#034;C&#034;\u00a0\u7981\u7528 C&#043;&#043; \u540d\u79f0\u4fee\u9970(Name Mangling)<\/li>\n<li>__declspec(dllexport)\u00a0\u663e\u5f0f\u5bfc\u51fa\u51fd\u6570<\/li>\n<li>\u6570\u636e\u7c7b\u578b\u6620\u5c04&#xff08;\u5982\u00a0string\u2192const char*&#xff09;<\/li>\n<li>\u5185\u5b58\u89c4\u5219&#xff1a;C# \u81ea\u52a8\u5c01\u9001\u5b57\u7b26\u4e32\u5185\u5b58<\/li>\n<hr \/>\n<h4>\u200b\u200b\u4e8c\u3001C&#043;&#043;\/CLI \u6865\u63a5 &#8211; \u6258\u7ba1\u4e0e\u975e\u6258\u7ba1\u7684\u53cc\u5411\u4ea4\u4e92\u200b\u200b<\/h4>\n<p>\u200b\u200b\u9002\u7528\u573a\u666f\u200b\u200b&#xff1a;\u9700\u8981\u5728\u4e24\u79cd\u4ee3\u7801\u95f4\u8fdb\u884c\u590d\u6742\u5bf9\u8c61\u4ea4\u4e92<\/p>\n<p>\/\/ C&#043;&#043;\/CLI \u5305\u88c5\u5c42 (.NET \u7a0b\u5e8f\u96c6)<br \/>\n#pragma once<\/p>\n<p>#include &#034;NativeCalculator.h&#034; \/\/ \u539f\u751f C&#043;&#043; \u7c7b<\/p>\n<p>public ref class ManagedCalculator<br \/>\n{<br \/>\npublic:<br \/>\n    ManagedCalculator() : nativePtr(new NativeCalculator()) {}<br \/>\n    ~ManagedCalculator() { delete nativePtr; }<\/p>\n<p>    double Calculate(double x)<br \/>\n    {<br \/>\n        \/\/ \u6258\u7ba1\u4ee3\u7801\u8c03\u7528\u975e\u6258\u7ba1\u4ee3\u7801<br \/>\n        return nativePtr-&gt;Compute(x);<br \/>\n    }<\/p>\n<p>    void SetCallback(Action&lt;double&gt;^ callback)<br \/>\n    {<br \/>\n        \/\/ \u975e\u6258\u7ba1\u4ee3\u7801\u56de\u8c03\u6258\u7ba1\u59d4\u6258<br \/>\n        nativePtr-&gt;SetCallback(<br \/>\n            gcnew NativeCallback([callback](double result) {<br \/>\n                callback(result);<br \/>\n            })<br \/>\n        );<br \/>\n    }<\/p>\n<p>private:<br \/>\n    NativeCalculator* nativePtr;<\/p>\n<p>    \/\/ \u975e\u6258\u7ba1\u7c7b\u5230\u59d4\u6258\u7684\u6865\u63a5<br \/>\n    delegate void NativeCallback(double result);<br \/>\n    NativeCallback^ managedDelegate;<br \/>\n};<\/p>\n<p>\u539f\u751f C&#043;&#043; \u7c7b (NativeCalculator.h)&#xff1a;<\/p>\n<p>\/\/ \u539f\u751f C&#043;&#043; \u7c7b<br \/>\nclass NativeCalculator {<br \/>\npublic:<br \/>\n    using Callback &#061; void(*)(double);<\/p>\n<p>    void SetCallback(Callback cb) { callback &#061; cb; }<\/p>\n<p>    double Compute(double x) {<br \/>\n        double result &#061; x * 2.5;<br \/>\n        if(callback) callback(result); \/\/ \u6267\u884c\u56de\u8c03<br \/>\n        return result;<br \/>\n    }<\/p>\n<p>private:<br \/>\n    Callback callback &#061; nullptr;<br \/>\n};<\/p>\n<p>C# \u8c03\u7528\u4ee3\u7801&#xff1a;<\/p>\n<p>var calc &#061; new ManagedCalculator();<br \/>\ncalc.SetCallback(result &#061;&gt;<br \/>\n    Console.WriteLine($&#034;C&#043;&#043; callback: {result}&#034;));<\/p>\n<p>double output &#061; calc.Calculate(4.2);<br \/>\nConsole.WriteLine($&#034;Result: {output}&#034;);<\/p>\n<p>\/* \u8f93\u51fa&#xff1a;<br \/>\n   C&#043;&#043; callback: 10.5<br \/>\n   Result: 10.5<br \/>\n*\/<\/p>\n<p>\u6838\u5fc3\u6280\u672f\u4f18\u52bf\u200b\u200b&#xff1a;<\/p>\n<li>\u65e0\u7f1d\u7ba1\u7406\u5bf9\u8c61\u751f\u547d\u5468\u671f&#xff08;\u6258\u7ba1\u6790\u6784\u51fd\u6570\u91ca\u653e\u975e\u6258\u7ba1\u5185\u5b58&#xff09;<\/li>\n<li>\u7c7b\u578b\u5b89\u5168\u8f6c\u6362&#xff08;\u81ea\u52a8\u5904\u7406gcnew\u6258\u7ba1\u5806\u5206\u914d&#xff09;<\/li>\n<li>\u652f\u6301\u590d\u6742\u7c7b\u578b\u53cc\u5411\u4f20\u9012<\/li>\n<li>\u5b9e\u73b0\u539f\u751f\u4ee3\u7801\u56de\u8c03.NET\u59d4\u6258<\/li>\n<hr \/>\n<h4>\u200b\u200b\u4e09\u3001COM \u4e92\u64cd\u4f5c &#8211; \u96c6\u6210\u4f20\u7edf\u7ec4\u4ef6\u200b\u200b<\/h4>\n<p>\u200b\u200b\u9002\u7528\u573a\u666f\u200b\u200b&#xff1a;\u8c03\u7528\u73b0\u6709 COM \u7ec4\u4ef6\u6216\u66b4\u9732 .NET \u7c7b\u4e3a COM<\/p>\n<p>\u200b\u200b\u8c03\u7528 COM \u7ec4\u4ef6&#xff1a;\u200b<\/p>\n<p>\/\/ \u5f15\u5165 COM \u7c7b\u578b\u5e93 (\u5982 EXCEL.EXE)<br \/>\nType excelType &#061; Type.GetTypeFromProgID(&#034;Excel.Application&#034;);<br \/>\ndynamic excel &#061; Activator.CreateInstance(excelType);<\/p>\n<p>excel.Visible &#061; true;<br \/>\ndynamic workbook &#061; excel.Workbooks.Add();<br \/>\ndynamic sheet &#061; workbook.ActiveSheet;<br \/>\nsheet.Cells[1, 1] &#061; &#034;Data from C#&#034;;<\/p>\n<p>Marshal.ReleaseComObject(sheet);<br \/>\nMarshal.ReleaseComObject(workbook);<br \/>\nexcel.Quit();<\/p>\n<p>\u66b4\u9732 .NET \u7c7b\u7ed9 COM&#xff1a;\u200b<\/p>\n<p>[ComVisible(true)]<br \/>\n[Guid(&#034;3AB1DF8C-71C1-4993-8CEF-FFDBFBB2A89E&#034;)]<br \/>\npublic interface ICalc<br \/>\n{<br \/>\n    double ProcessData(double input);<br \/>\n}<\/p>\n<p>[ComVisible(true)]<br \/>\n[ClassInterface(ClassInterfaceType.None)]<br \/>\npublic class DataProcessor : ICalc<br \/>\n{<br \/>\n    public double ProcessData(double input) &#061;&gt;<br \/>\n        Math.Sqrt(input) * 0.87;<br \/>\n}<\/p>\n<p>\u5173\u952e\u6b65\u9aa4\u200b\u200b&#xff1a;<\/p>\n<li>\u4f7f\u7528regasm \/codebase\u6ce8\u518c .NET \u7a0b\u5e8f\u96c6<\/li>\n<li>\u751f\u6210\u7c7b\u578b\u5e93 (tlbexp\u00a0\u6216 Visual Studio \u5d4c\u5165\u8bbe\u7f6e)<\/li>\n<li>COM \u5ba2\u6237\u7aef\u901a\u8fc7 GUID \u6216 ProgID \u521b\u5efa\u5b9e\u4f8b<\/li>\n<hr \/>\n<h4>\u200b\u200b\u56db\u3001\u5185\u5b58\u6620\u5c04\u6587\u4ef6 &#8211; \u9ad8\u6027\u80fd\u6570\u636e\u4ea4\u6362\u200b\u200b<\/h4>\n<p>\u200b\u200b\u9002\u7528\u573a\u666f\u200b\u200b&#xff1a;\u8fdb\u7a0b\u95f4\u5927\u6570\u636e\u4ea4\u6362&#xff08;\u907f\u514d\u5c01\u9001\u5f00\u9500&#xff09;<\/p>\n<p>\u200b\u200bC&#043;&#043; \u751f\u4ea7\u8005&#xff1a;\u200b<\/p>\n<p>#include &lt;Windows.h&gt;<\/p>\n<p>HANDLE hMapFile &#061; CreateFileMapping(<br \/>\n    INVALID_HANDLE_VALUE,<br \/>\n    NULL,<br \/>\n    PAGE_READWRITE,<br \/>\n    0, 1024, \/\/ 1KB\u5185\u5b58\u533a<br \/>\n    L&#034;Global\\\\\\\\SharedMemory&#034;);<\/p>\n<p>double* data &#061; (double*)MapViewOfFile(<br \/>\n    hMapFile, FILE_MAP_WRITE, 0, 0, 1024);<\/p>\n<p>\/\/ \u5199\u5165\u6570\u636e<br \/>\ndata[0] &#061; 3.1415926;<br \/>\ndata[1] &#061; 2.71828;<\/p>\n<p>C# \u6d88\u8d39\u8005&#xff1a;<\/p>\n<p>using var shm &#061; MemoryMappedFile.OpenExisting(<br \/>\n    &#034;SharedMemory&#034;, MemoryMappedFileRights.Read);<br \/>\nusing var accessor &#061; shm.CreateViewAccessor(0, 1024);<\/p>\n<p>accessor.Read(0, out double pi);<br \/>\naccessor.Read(8, out double e);<\/p>\n<p>Console.WriteLine($&#034;PI&#061;{pi}, E&#061;{e}&#034;);<\/p>\n<p>\u6027\u80fd\u5173\u952e\u200b\u200b&#xff1a;<\/p>\n<li>\u5b8c\u5168\u907f\u514d\u5e8f\u5217\u5316\/\u53cd\u5e8f\u5217\u5316\u5f00\u9500<\/li>\n<li>\u652f\u6301 GB \u7ea7\u6570\u636e\u4ea4\u6362&#xff08;\u4ec5\u53d7\u865a\u62df\u5185\u5b58\u9650\u5236&#xff09;<\/li>\n<li>\u9700\u8981\u540c\u6b65\u673a\u5236&#xff08;Mutex\/Semaphore&#xff09;<\/li>\n<hr \/>\n<h3>\u200b\u200b\u4e94\u3001\u6280\u672f\u9009\u578b\u51b3\u7b56\u6811\u200b\u200b<\/h3>\n<li>\u200b\u200b\u7b80\u5355\u51fd\u6570\u8c03\u7528\u200b\u200b \u2192 P\/Invoke<\/li>\n<li>\u200b\u200b\u590d\u6742\u5bf9\u8c61\u4ea4\u4e92\/\u53cc\u5411\u8c03\u7528\u200b\u200b \u2192 C&#043;&#043;\/CLI<\/li>\n<li>\u200b\u200b\u7ee7\u627f\u73b0\u6709 COM \u7cfb\u7edf\u200b\u200b \u2192 COM Interop<\/li>\n<li>\u200b\u200b\u5927\u6570\u636e\/\u9ad8\u9891\u901a\u4fe1\u200b\u200b \u2192 \u5185\u5b58\u6620\u5c04 &#043; \u4fe1\u53f7\u91cf<\/li>\n<li>\u200b\u200b\u8de8\u5e73\u53f0\u9700\u6c42\u200b\u200b \u2192 P\/Invoke (Unix\/Linux \u4e0b\u4f7f\u7528libdl)<\/li>\n<hr \/>\n<h3>\u200b\u200b\u5173\u952e\u6ce8\u610f\u4e8b\u9879\u200b\u200b<\/h3>\n<li>\n<p>\u200b\u200b\u7c7b\u578b\u7cfb\u7edf\u9677\u9631\u200b\u200b&#xff1a;<\/p>\n<ul>\n<li>C&#043;&#043;\u00a0bool\u00a0\u2260 C#\u00a0bool\u00a0(\u524d\u8005\u662f4\u5b57\u8282&#xff0c;\u540e\u8005\u662f1\u5b57\u8282)<\/li>\n<li>\u4f7f\u7528[MarshalAs(UnmanagedType.I1)]\u660e\u786e\u6307\u5b9a\u5e03\u5c14\u7c7b\u578b<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u200b\u200b\u5185\u5b58\u7ba1\u7406\u8fb9\u754c\u200b\u200b&#xff1a;<\/p>\n<p>\/\/ P\/Invoke\u5185\u5b58\u56de\u6536\u793a\u4f8b<br \/>\n[DllImport(&#034;NativeLib.dll&#034;)]<br \/>\nprivate static extern IntPtr CreateBuffer(int size);<\/p>\n<p>[DllImport(&#034;NativeLib.dll&#034;)]<br \/>\nprivate static extern void FreeBuffer(IntPtr ptr);<\/p>\n<\/li>\n<li>\n<p>\u200b\u200b\u7ebf\u7a0b\u534f\u540c\u200b\u200b&#xff1a;<\/p>\n<ul>\n<li>COM \u9700\u521d\u59cb\u5316\u5355\u7ebf\u7a0b\u5355\u5143([STAThread])<\/li>\n<li>C&#043;&#043;\/CLI \u6258\u7ba1\u7ebf\u7a0b\u9700\u9644\u52a0\u5230\u975e\u6258\u7ba1\u73af\u5883<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u200b\u200b\u5f02\u5e38\u5904\u7406\u200b\u200b&#xff1a;<\/p>\n<p>\/\/ C&#043;&#043; \u7aef\u6355\u83b7\u6258\u7ba1\u5f02\u5e38<br \/>\ntry { \/* \u8c03\u7528.NET\u65b9\u6cd5 *\/ }<br \/>\ncatch (System::Exception^ ex) {<br \/>\n   std::cerr &lt;&lt; MarshalString(ex-&gt;Message);<br \/>\n}<\/p>\n<\/li>\n<p>\u901a\u8fc7\u5408\u7406\u7684\u67b6\u6784\u8bbe\u8ba1\u548c\u7cbe\u51c6\u7684\u6280\u672f\u9009\u578b&#xff0c;C# \u4e0e C&#043;&#043; \u7684\u4e92\u64cd\u4f5c\u5c06\u6210\u4e3a\u6784\u5efa\u9ad8\u6027\u80fd\u6df7\u5408\u7cfb\u7edf\u7684\u5229\u5251&#xff0c;\u5728\u4fdd\u6301\u5f00\u53d1\u6548\u7387\u7684\u540c\u65f6\u7a81\u7834\u7eaf\u6258\u7ba1\u73af\u5883\u7684\u6027\u80fd\u9650\u5236\u3002<\/p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb64\u6b21\u3002\u901a\u8fc7\u5408\u7406\u7684\u67b6\u6784\u8bbe\u8ba1\u548c\u7cbe\u51c6\u7684\u6280\u672f\u9009\u578b\uff0cC# \u4e0e C++ \u7684\u4e92\u64cd\u4f5c\u5c06\u6210\u4e3a\u6784\u5efa\u9ad8\u6027\u80fd\u6df7\u5408\u7cfb\u7edf\u7684\u5229\u5251\uff0c\u5728\u4fdd\u6301\u5f00\u53d1\u6548\u7387\u7684\u540c\u65f6\u7a81\u7834\u7eaf\u6258\u7ba1\u73af\u5883\u7684\u6027\u80fd\u9650\u5236\u3002<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[55,4888,190],"topic":[],"class_list":{"0":"post-50214","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"hentry","6":"category-server","7":"tag-c","9":"tag-190"},"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>C#\u4e0eC++\u4e92\u64cd\u4f5c\u793a\u4f8b - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/50214.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"C#\u4e0eC++\u4e92\u64cd\u4f5c\u793a\u4f8b - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb64\u6b21\u3002\u901a\u8fc7\u5408\u7406\u7684\u67b6\u6784\u8bbe\u8ba1\u548c\u7cbe\u51c6\u7684\u6280\u672f\u9009\u578b\uff0cC# \u4e0e C++ \u7684\u4e92\u64cd\u4f5c\u5c06\u6210\u4e3a\u6784\u5efa\u9ad8\u6027\u80fd\u6df7\u5408\u7cfb\u7edf\u7684\u5229\u5251\uff0c\u5728\u4fdd\u6301\u5f00\u53d1\u6548\u7387\u7684\u540c\u65f6\u7a81\u7834\u7eaf\u6258\u7ba1\u73af\u5883\u7684\u6027\u80fd\u9650\u5236\u3002\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/50214.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2025-07-30T14:11:33+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/50214.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/50214.html\",\"name\":\"C#\u4e0eC++\u4e92\u64cd\u4f5c\u793a\u4f8b - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2025-07-30T14:11:33+00:00\",\"dateModified\":\"2025-07-30T14:11:33+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/50214.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/50214.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/50214.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"C#\u4e0eC++\u4e92\u64cd\u4f5c\u793a\u4f8b\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"C#\u4e0eC++\u4e92\u64cd\u4f5c\u793a\u4f8b - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/50214.html","og_locale":"zh_CN","og_type":"article","og_title":"C#\u4e0eC++\u4e92\u64cd\u4f5c\u793a\u4f8b - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb64\u6b21\u3002\u901a\u8fc7\u5408\u7406\u7684\u67b6\u6784\u8bbe\u8ba1\u548c\u7cbe\u51c6\u7684\u6280\u672f\u9009\u578b\uff0cC# \u4e0e C++ \u7684\u4e92\u64cd\u4f5c\u5c06\u6210\u4e3a\u6784\u5efa\u9ad8\u6027\u80fd\u6df7\u5408\u7cfb\u7edf\u7684\u5229\u5251\uff0c\u5728\u4fdd\u6301\u5f00\u53d1\u6548\u7387\u7684\u540c\u65f6\u7a81\u7834\u7eaf\u6258\u7ba1\u73af\u5883\u7684\u6027\u80fd\u9650\u5236\u3002","og_url":"https:\/\/www.wsisp.com\/helps\/50214.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2025-07-30T14:11:33+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"3 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/50214.html","url":"https:\/\/www.wsisp.com\/helps\/50214.html","name":"C#\u4e0eC++\u4e92\u64cd\u4f5c\u793a\u4f8b - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2025-07-30T14:11:33+00:00","dateModified":"2025-07-30T14:11:33+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/50214.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/50214.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/50214.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"C#\u4e0eC++\u4e92\u64cd\u4f5c\u793a\u4f8b"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/50214","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=50214"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/50214\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=50214"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=50214"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=50214"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=50214"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}