草庐IT

function-handle

全部标签

c# - 无效操作异常 : No IAuthenticationSignInHandler is configured to handle sign in for the scheme: MyCookieAuthenticationScheme

我正在尝试按照说明进行操作here将Cookie身份验证添加到我的网站。到目前为止,我添加了以下内容:InvoketheUseAuthenticationmethodintheConfiguremethodoftheStartup.csfile:app.UseAuthentication();InvoketheAddAuthenticationandAddCookiemethodsintheConfigureServicesmethodoftheStartup.csfile:services.AddAuthentication("MyCookieAuthenticationScheme

c# - PInvoke C# : Function takes pointer to function as argument

我想在我的C#代码中访问这个函数,这可能吗?所以最后C++代码会调用我的函数并应用名为“sFrameofData”的结构。C++代码://Theusersuppliedfunctionwillbecalledwheneveraframeofdataarrives.DLLintCortex_SetDataHandlerFunc(void(*MyFunction)(sFrameOfData*pFrameOfData));这也许行得通吗?C#代码:[DllImport("Cortex_SDK.dll")]publicexternstaticintCortex_SetDataHandlerFu

c# - 使用 "Expression Bodied Functions and Properties"有什么好处

这个问题在这里已经有了答案:Expression-bodiedfunctionmembersefficiencyandperformanceinC#6.0(2个答案)关闭6年前。我确实看到很多人使用该新功能,但使用这些表达式有什么好处?Examples:publicoverridestringToString()=>string.Format("{0},{1}",First,Second);publicstringText=>string.Format("{0}:{1}-{2}({3})",TimeStamp,Process,Config,User);这个问题不同于thisone,因为

c# - Azure Functions 如何将应用程序设置添加到绑定(bind)

我正在尝试使用我的Azure函数的应用设置添加一些自定义绑定(bind)。我只需要从我的设置中接收一个字符串。我想从我的设置中获取simpleValue。{"bindings":[{"name":"someValue","type":"stringSetting","connection":"simpleValue","direction":"in"}],"disabled":false}并在Run方法中获取它:staticvoidGetOrders(TraceWriterlog,stringsomeValue){log.Info(someValue);}有可能吗?也许还有其他方法可以

c# - 在 Azure Function 中运行 .exe 可执行文件

我有可执行文件abcd.exe(它包含/合并了许多.dll)。是否可以为abcd.exe创建AzureFunctions并在AzureCloudFunctions中运行它?abcd.exe应用程序:System.Diagnostics.Processprocess=newSystem.Diagnostics.Process();System.Diagnostics.ProcessStartInfostartInfo=newSystem.Diagnostics.ProcessStartInfo();startInfo.WindowStyle=System.Diagnostics.Proc

c# - 调试 C++/Cli : <Unknown function> and no Locals

我正在尝试使用C#程序集和C++/Cli程序集调试项目。C#中定义的接口(interface)由C++/Cli类继承,后者又调用nativeC++类。在C++和C#程序集以及启动.exe中都启用了混合模式调试。现在,当我尝试调试C++部分时,它变得很棘手;如果我只是在C++部分设置断点,它们就不会被击中(尽管我知道它们被击中是因为日志(等)被写入并且在那里抛出异常实际上会正确地抛出它)。当我在调用混合模式程序集之前在C#中的最新调用处设置断点时,我可以进入C++/Cli代码,甚至可以进入native部分。但是,调用堆栈显示为MyMixedMode.dll!Line...而且我无法检查任

C# 和 WUAPI : BeginDownload function

首先,我没有任何面向对象编程的经验。我在学校创建了我的VB脚本和一些Java,仅此而已。所以我的问题很可能就在那里。但是尽管如此,在过去的几天里,我一直在尝试整合一个小应用程序,让我可以扫描、选择和安装Windows更新。到目前为止,借助互联网上的一些帖子,我已经能够理解大部分引用资料,现在我可以选择和下载更新。到目前为止,我已经能够使用以下代码下载一组更新:UpdateCollectionCurrentInstallCollection=(UpdateCollection)e.Argument;UpdateDownloaderCurrentDownloader=CurrentSess

c# - 接口(interface)继承多个接口(interface) : how is this handled by a C# compiler?

最近我发现C#允许Aninterfacecaninheritfromoneormorebaseinterfaces.例如,Caliburn.Micro中的IScreen在http://caliburnmicro.codeplex.com/SourceControl/latest#src/Caliburn.Micro/IScreen.cs中执行此操作namespaceCaliburn.Micro{publicinterfaceIScreen:IHaveDisplayName,IActivate,IDeactivate,IGuardClose,INotifyPropertyChangedE

c# - "Only catch exceptions you can handle"到底是什么意思?

我的任务是为我正在处理的.NET/C#项目编写异常处理策略和指南文档。我很难做到。关于如何/何时抛出、捕获、包装异常,有很多可用的信息,但我正在寻找描述除了包装和抛出异常之外的catchblock内应该进行哪些类型的事情。try{DoSomethingNotNice();}catch(ExceptionICanHandleex){//Lookingforexamplesofwhatpeoplearedoingincatchblocks//otherthanthroworwrappingtheexception,andthrowing.}提前致谢 最佳答案

C# : Blocking a function call until condition met

我正在开发一个C#Winforms应用程序,应用程序的一部分将使用AsyncUpload将文件上传到网络服务器(使用它,由于需要使用porgress回调),在C#程序中我有一个调用上传函数的简单for循环for(inti=0;i有趣的是有一些魔力:Uploadfun(){//Logiccomeshere//webClient.UploadFileAsyncrunsa2ndthreadtoperformupload..webClient.UploadFileAsync(uri,"PUT",fileNameOnHD);}异步上传完成时调用的回调Upload_Completed_callba