国产中文字幕在线播放_久久久久99精品国产片_66久久国产_国产精品自在在线_亚洲成av人片_国产一级黄色电影_伊人在线视频_欧美黄视频在线观看

 

咨詢chatGPT關于c#腳本的方案,全文無任何修改。 快報

發布時間:2023-04-20 20:16:25  |  來源:博客園  

只有一句話,炸天了。我打的錯別字都沒有修改,它竟然也能聽的懂,回答的非常到位,而且沒有錯別字。

而且回復的內容水平很高,沒有四五年工作經驗的人寫不出來這么高水平的答復,而且是瞬間給的答案。內容正確的同時還沒有錯別字。


(資料圖片)

可能他會詞法分析,聊天內容中的X和myObjects等都是著色的,我復制到cnblogs發貼的時候顏色丟了。

==============以下是聊天記錄 2023-04-20通過cursor使用gpt4============

用c#來開發一個帶有腳本功能的系統,用哪個庫來實現腳本好一點?

TodevelopasystemwithscriptingcapabilitiesinC#,apopularlibrarytouseistheRoslynScriptingAPI.ThislibraryallowsfortheexecutionofC#codeatruntime,makingitagreatchoiceforimplementingscriptingfunctionality.TousetheRoslynScriptingAPI,youwillneedtoaddthefollowingNuGetpackagetoyourproject:

Microsoft.CodeAnalysis.CSharp.Scripting

Onceyouhaveaddedthispackage,youcanusetheCSharpScriptclasstocompileandexecuteC#codeatruntime.HereisanexampleofhowtousetheCSharpScriptclasstoexecuteasimpleC#script:

using Microsoft.CodeAnalysis.CSharp.Scripting;using Microsoft.CodeAnalysis.Scripting; // Define the script code as a stringstring scriptCode = "int x = 1 + 2;"; // Create a new script objectScript script = CSharpScript.Create(scriptCode); // Execute the script and get the resultScriptState result = await script.RunAsync(); // Get the value of the "x" variable from the scriptint x = result.Variables["x"].Value;

Inthisexample,wedefineasimpleC#scriptthatsetsthevalueofthexvariableto1+2.WethencreateanewCSharpScriptobjectwiththiscodeandexecuteitusingtheRunAsyncmethod.Finally,weretrievethevalueofthexvariablefromthescriptusingtheVariablespropertyoftheScriptStateobjectreturnedbyRunAsync.

WiththeRoslynScriptingAPI,youcaneasilyaddscriptingcapabilitiestoyourC#application.

還有其它的推薦嗎?

Basedonyourquestion,itseemslikeyouarelookingforalternativelibrariestotheRoslynScriptingAPIforimplementingscriptingfunctionalityinC#.WhiletheRoslynScriptingAPIisapopularchoice,thereareotherlibrariesavailablethatyoumaywanttoconsider.OnesuchlibraryistheJurassiclibrary,whichisaJavaScriptinterpreterfor.NET.ThislibraryallowsyoutoexecuteJavaScriptcodeatruntime,whichcanbeusefulifyouwanttoprovideascriptinginterfacethatismorefamiliartowebdevelopers.HereisanexampleofhowtousetheJurassiclibrarytoexecuteasimpleJavaScriptscript:

using Jurassic;// Define the script code as a stringstring scriptCode = "var x = 1 + 2;";// Create a new script engineScriptEngine engine = new ScriptEngine();// Execute the script and get the resultobject result = engine.Evaluate(scriptCode);// Get the value of the "x" variable from the scriptint x = Convert.ToInt32(engine.GetGlobalValue("x"));

Inthisexample,wedefineasimpleJavaScriptscriptthatsetsthevalueofthexvariableto1+2.WethencreateanewScriptEngineobjectwiththeJurassiclibraryandexecutethescriptusingtheEvaluatemethod.Finally,weretrievethevalueofthexvariablefromthescriptusingtheGetGlobalValuemethodoftheScriptEngineobject.AnotherlibraryyoumaywanttoconsideristheIronPythonlibrary,whichisaPythoninterpreterfor.NET.ThislibraryallowsyoutoexecutePythoncodeatruntime,whichcanbeusefulifyouwanttoprovideascriptinginterfacethatismorefamiliartoPythondevelopers.HereisanexampleofhowtousetheIronPythonlibrarytoexecuteasimplePythonscript:

using IronPython.Hosting;using Microsoft.Scripting.Hosting;// Define the script code as a stringstring scriptCode = "x = 1 + 2";// Create a new script engineScriptEngine engine = Python.CreateEngine();// Execute the script and get the resultScriptScope scope = engine.CreateScope();engine.Execute(scriptCode, scope);// Get the value of the "x" variable from the scriptint x = scope.GetVariable("x");

Inthisexample,wedefineasimplePythonscriptthatsetsthevalueofthexvariableto1+2.WethencreateanewScriptEngineobjectwiththeIronPythonlibraryandexecutethescriptusingtheExecutemethod.Finally,weretrievethevalueofthexvariablefromthescriptusingtheGetVariablemethodoftheScriptScopeobject.Overall,whiletheRoslynScriptingAPIisapopularchoiceforimplementingscriptingfunctionalityinC#,thereareotherlibrariesavailablethatyoumaywanttoconsiderdependingonyourspecificneedsandrequirements.

您推薦的roslyn、JavaScript、python,都支持傳入c#對象作為變量嗎?

Basedonyourquestion,itseemslikeyouareinterestedinpassingC#objectsasvariablestotheRoslynScriptingAPI,Jurassic,andIronPythonlibraries.TheRoslynScriptingAPIdoessupportpassingC#objectsasvariablestoscripts.YoucandothisbyusingtheScriptOptions.Default.WithReferencesandScriptOptions.Default.WithImportsmethodstoaddanynecessaryreferencesandimportstothescript,andthenusingtheScriptState.VariablespropertytopassintheC#objectasavariable.HereisanexampleofhowtopassaC#objectasavariabletoascriptusingtheRoslynScriptingAPI:

using Microsoft.CodeAnalysis.CSharp.Scripting;using Microsoft.CodeAnalysis.Scripting;// Define the script code as a stringstring scriptCode = "x = myObject.MyProperty;";// Create a new script object with the necessary references and importsScript script = CSharpScript.Create(scriptCode, ScriptOptions.Default.WithReferences(typeof(MyObject).Assembly), ScriptOptions.Default.WithImports("MyNamespace"));// Create a new script state with the C# object as a variableMyObject myObject = new MyObject();ScriptState result = await script.RunAsync(new { myObject });// Get the value of the "x" variable from the scriptint x = result.Variables["x"].Value;

Inthisexample,wedefineasimpleC#scriptthatsetsthevalueofthexvariabletothevalueoftheMyPropertypropertyofaC#objectcalledmyObject.WethencreateanewCSharpScriptobjectwiththenecessaryreferencesandimportstoaccesstheMyObjecttypeandnamespace,andexecutethescriptusingtheRunAsyncmethodwiththemyObjectvariablepassedinasaparameter.Finally,weretrievethevalueofthexvariablefromthescriptusingtheVariablespropertyoftheScriptStateobjectreturnedbyRunAsync.TheJurassiclibraryalsosupportspassingC#objectsasvariablestoJavaScriptscripts.YoucandothisbyusingtheScriptEngine.SetGlobalValuemethodtosettheC#objectasaglobalvariableinthescriptengine,andthenaccessingitfromthescriptusingtheglobalobject.HereisanexampleofhowtopassaC#objectasavariabletoaJavaScriptscriptusingtheJurassiclibrary:

using Jurassic;// Define the script code as a stringstring scriptCode = "x = myObject.MyProperty;";// Create a new script engineScriptEngine engine = new ScriptEngine();// Set the C# object as a global variable in the script engineMyObject myObject = new MyObject();engine.SetGlobalValue("myObject", myObject);// Execute the script and get the resultobject result = engine.Evaluate(scriptCode);// Get the value of the "x" variable from the scriptint x = Convert.ToInt32(engine.GetGlobalValue("x"));

Inthisexample,wedefineasimpleJavaScriptscriptthatsetsthevalueofthexvariabletothevalueoftheMyPropertypropertyofaC#objectcalledmyObject.WethencreateanewScriptEngineobjectwiththeJurassiclibrary,setthemyObjectvariableasaglobalvariableinthescriptengineusingtheSetGlobalValuemethod,andexecutethescriptusingtheEvaluatemethod.Finally,weretrievethevalueofthexvariablefromthescriptusingtheGetGlobalValuemethodoftheScriptEngineobject.TheIronPythonlibraryalsosupportspassingC#objectsasvariablestoPythonscripts.YoucandothisbyusingtheScriptEngine.Runtime.Globals.SetVariablemethodtosettheC#objectasavariableinthescriptengine,andthenaccessingitfromthescriptusingthevariablename.HereisanexampleofhowtopassaC#objectasavariabletoaPythonscriptusingtheIronPythonlibrary:

using IronPython.Hosting;using Microsoft.Scripting.Hosting;// Define the script code as a stringstring scriptCode = "x = myObject.MyProperty";// Create a new script engineScriptEngine engine = Python.CreateEngine();// Set the C# object as a variable in the script engineMyObject myObject = new MyObject();engine.Runtime.Globals.SetVariable("myObject", myObject);// Execute the script and get the resultScriptScope scope = engine.CreateScope();engine.Execute(scriptCode, scope);// Get the value of the "x" variable from the scriptint x = scope.GetVariable("x");

Inthisexample,wedefineasimplePythonscriptthatsetsthevalueofthexvariabletothevalueoftheMyPropertypropertyofaC#objectcalledmyObject.WethencreateanewScriptEngineobjectwiththeIronPythonlibrary,setthemyObjectvariableasavariableinthescriptengineusingtheSetVariablemethodoftheScriptEngine.Runtime.Globalsproperty,andexecutethescriptusingtheExecutemethod.Finally,weretrievethevalueofthexvariablefromthescriptusingtheGetVariablemethodoftheScriptScopeobject.Overall,allthreelibrariessupportpassingC#objectsasvariablestoscripts,althoughthespecificsyntaxandmethodsusedmaydifferslightlybetweenthem.

與沒有調試和運行roslyn的UI編輯器?最好是開源的,不要非常龐大的。

Basedonyourquery,itseemslikeyouarelookingforanopen-sourceUIeditorthatdoesnotrequiredebuggingandrunningRoslyn,andisnottoolarge.OneoptionyoumaywanttoconsideristheAvalonEditlibrary,whichisaWPF-basedtexteditorcontrolthatsupportssyntaxhighlighting,codefolding,andotherfeaturescommonlyfoundincodeeditors.Whileitdoesnothavebuilt-insupportforRoslyn,itdoesprovideaflexibleAPIthatallowsyoutointegratewithRoslynorothercodeanalysislibrariesifneeded.AnotheroptionyoumaywanttoconsideristheScintillaNETlibrary,whichisa.NETwrapperfortheScintillatexteditingcomponent.Scintillasupportssyntaxhighlighting,codefolding,andotherfeaturescommonlyfoundincodeeditors,andhasasmallfootprintcomparedtosomeothercodeeditinglibraries.Whileitdoesnothavebuilt-insupportforRoslyn,itdoesprovideaflexibleAPIthatallowsyoutointegratewithRoslynorothercodeanalysislibrariesifneeded.Overall,whiletheremaynotbeaspecificUIeditorthatmeetsallofyourrequirements,bothAvalonEditandScintillaNETareopen-sourcelibrariesthatprovideasolidfoundationforbuildingacustomUIeditorwithsupportforsyntaxhighlightingandothercodeeditingfeatures.

關鍵詞:

 

關于我們 - 聯系我們 - 版權聲明 - 招聘信息 - 友鏈交換

2014-2020  電腦商網 版權所有. All Rights Reserved.

備案號:京ICP備2022022245號-1 未經過本站允許,請勿將本站內容傳播或復制.

聯系我們:435 226 40@qq.com

久久狠狠婷婷| 一个人免费观看视频www在线播放| 黄动漫在线看| 老鸭窝一区二区久久精品| p色视频免费在线观看| 99久久精品情趣| 电影k8一区二区三区久久| 国产精品亚洲专一区二区三区| 91精品国产欧美一区二区18| 天堂а√在线8种子蜜桃视频| 国产一区二区| 国产成人av电影在线播放| 日韩久久免费视频| 欧美精选视频在线观看| 中文字幕午夜精品一区二区三区 | 亚洲精品成人少妇| 亚洲成人av片| 欧美96在线| 久久经典综合| 欧美日韩国产在线播放网站| 亚洲欧美日韩一区二区三区在线| av免费在线免费| 久久一本综合| 国产欧美69| 97久久超碰国产精品| 综合色中文字幕| 欧洲激情一区二区| 调教视频在线观看| 在线欧美三级| 国内精品久久久久久久影视蜜臀| 一区二区三区四区不卡视频| 国产激情二区| 性爽视频在线| 日韩视频二区| 午夜不卡av免费| 精品极品在线| 久久久久久一区二区| 中文av一区二区| av小说在线| 国模雨婷捆绑高清在线| 欧美成人基地| 亚洲国产国产亚洲一二三| 91理论电影在线观看| 日韩av中文在线| 九色porny丨首页在线| 日韩综合在线| 理论电影国产精品| 久久精品亚洲精品国产欧美 | 久久九九国产| 久久精品人人做人人爽97| 一本久久综合亚洲鲁鲁五月天 | sm捆绑调教国产免费网站在线观看| 一区二区三区午夜视频| 日韩成人av网址| 国产欧美三级| 午夜在线成人av| 在线观看av网站| 日韩成人dvd| 在线播放国产精品二区一二区四区| 午夜国产在线| eeuss国产一区二区三区四区| 国产日韩欧美一区在线| 亚洲综合男人的天堂| 超碰在线无需免费| 国产区精品区| 国产mv日韩mv欧美| 亚洲精品福利在线| 澳门久久精品| 久久精品亚洲精品国产欧美 | 成人免费福利| 一区在线视频| 一区精品在线播放| 久草在线资源视频在线观看| 啪啪国产精品| 亚洲美女少妇撒尿| 亚洲色图美腿丝袜| 国产精品亚洲欧美一级在线| 久久国产精品免费| 国产精品夜夜嗨| 欧美日本三级| 久久99国产精品免费网站| 精品美女在线观看| 久久国产精品毛片| 麻豆影视在线| 国产专区欧美精品| 亚洲国产精品va在线看黑人| av影院在线| 一区二区三区四区视频精品免费| 亚洲国产一区二区三区网站| 欧美日韩国产色视频| 日韩国产激情| 中文av一区二区| 国产亚洲欧美日韩精品一区二区三区| 国产一级精品在线| 午夜精品福利影院| 欧美性感一区二区三区| 国偷自产视频一区二区久| 国产精品女上位| 亚洲大胆人体av| 国产亚洲一卡2卡3卡4卡新区 | 亚洲色图日韩av| 99热在线成人| 欧美大片在线观看| 亚洲无中文字幕| eeuss在线观看| 亚洲美女网站| 有色激情视频免费在线| 91丨九色丨国产丨porny| 91九色在线播放| 精品久久在线播放| 国产一区一区| 欧美午夜视频在线观看| 亚洲天堂中文字幕在线观看| 疯狂欧美牲乱大交777| 少妇高潮一区二区三区99| 波多野结衣一区二区三区 | 亚洲欧美日韩在线一区| 久久国产直播| 亚洲一区网址| 日韩成人免费视频| 久久精品日产第一区二区三区高清版 | 欧美一级二级三级视频| 精品久久久久久久久久久院品网 | 国产精品亲子伦对白| 亚洲性色av| 欧美一二三区在线| 日韩高清不卡一区二区| 九色91在线| 精品剧情v国产在线观看| 成人在线一区二区三区| 91麻豆精品| 视频二区在线| 久久一二三国产| 亚洲欧洲自拍| 亚洲成a人v欧美综合天堂| 欧美人与拘性视交免费看| 国产精品秘入口| 亚洲男人的天堂在线aⅴ视频| 色999日韩| 麻豆影院在线观看| 99久久国产免费看| 欧美sm一区| 欧美日韩一区二区在线播放| 亚洲91久久| 成人黄色在线| 777视频在线观看| 国产视频不卡一区| 日本亚洲视频在线| 在线精品国产| 欧美日韩岛国| 99久久99久久精品国产片果冰| 99精品女人在线观看免费视频| 韩国理伦片久久电影网| 亚洲国产精品va| 麻豆精品久久久| 久久青草伊人| 欧美婷婷六月丁香综合色| 91丨porny丨在线| 欧美另类视频| 国产伦精品一区二区三区视频| 亚洲一区二区三区四区| 超碰99在线| 在线观影网站| 日韩在线无毛| 丁香婷婷在线| 欧美日韩国产综合视频| 欧美日免费三级在线| 亚洲成人在线免费| 亚洲国产人成综合网站| 又黄又爽无遮挡| 性欧美猛交videos| 91青青国产在线观看精品| 国产乱国产乱300精品| 欧美性生交xxxxxdddd| 亚洲国产中文字幕久久网| 亚洲成人影院少妇| 伊人手机在线| 香蕉视频免费在线播放| 青春草视频在线观看| 国产精品亚洲综合在线观看| 成人动漫免费在线观看| 影音先锋亚洲电影| 中文字幕综合网| 国产精品午夜电影| 色综合久久久久综合| 色婷婷av一区二区三区软件| 亚洲精品电影在线| 欧美性videos| 欧美一性一交| 91色.com| 欧美日韩精品在线观看| 在线不卡一区二区| 日漫免费在线观看网站| 国产一区二区在线视频你懂的| 日韩午夜免费| 欧美性猛交视频| 亚洲欧美色图小说| 欧美麻豆精品久久久久久| 香蕉成人app免费看片| 欧美视频二区|