草庐IT

can-i-extract-application-data-fr

全部标签

c# - 通用约束 : Can I test Equality of generic that can be a reference or value type?

我想要一个通用类,它可以接受引用类型或值类型,并且只执行基于相等性测试的操作。考虑以下几点:publicclassPropertywhereTProp:struct,IEquatable{publicTPropValue;publicvoidSetValue(ObservableObjectowner,TPropvalue){if(!Value.Equals(value))//cannotuse!=onstructconstrainedTProp{//...settheproperty}}}publicclassByRefPropertywhereTProp:class//Dontwa

c# - 帮助我理解 "LINQ to Entities only supports casting Entity Data Model primitive types"

我有一个工作单元和一个使用EF4和POCO的存储库。由于EF在可以Skip()和Take()之前需要一个有序集,因此我添加了以下单元测试(没有模拟)只是为了提取一条记录以查看它是否有效。varmyList=UOW.EntityRepo.Get(orderbyLambda:p=>p.ID,page:1,pageSize:1);这导致表达式orderbyLambda={p=>Convert(p.ID)}和枚举期间的错误。ID是tinyint(Int16/短)那么为什么按ID排序失败呢?有关错误的更多信息Unabletocastthetype'System.Int16'totype'Syst

c# - Application.SetCompatibleTextRenderingDefault(false);

Application.SetCompatibleTextRenderingDefault(false);错误:BeforetheestablishmentofthefirstobjectIWin32WindowintheannextocallSetCompatibleTextRenderingDefault.为什么会出错?如何避免?SetCompatibleTextRenderingDefault实际上做了什么? 最佳答案 在.NET1.x中,GDI+Graphics类用于呈现某些控件。由于性能问题,此方法已被废弃,因此.NET2

c# - Application.Quit() 方法无法清除进程

我已经看到很多从Google搜索返回的关于此的帖子,但其中引用的解决方案都没有为我解决这个问题。所以,我想我自己试试。在这段代码之后:PowerPoint.ApplicationpowerPoint=newMicrosoft.Office.Interop.PowerPoint.Application();powerPoint.Visible=Office.MsoTriState.msoTrue;Microsoft.Office.Interop.PowerPoint.Presentationppt=null;entercodehere我可以发出ppt.Quit();命令和Powerpoi

c# - 请求类型为“System.Data.SqlClient.SqlClientPermission, System.Data, Version=4.0.0.0”的权限

我有一个WPF网络应用程序,我正在尝试访问SQL2000数据库,但出现以下错误:Requestforthepermissionoftype'System.Data.SqlClient.SqlClientPermission,System.Data,Version=4.0.0.0,Culture=neutral,PublicKeyToken=b77a5c561934e089'failed.知道如何解决这个问题吗?我可能需要一个示例,因为我是新手,这是我的第一个WPF应用程序。 最佳答案 尝试切换到完全信任应用程序。

C# .net MVC,设置 Google Application Credentials JSON 文件的路径

我刚刚获得了这个Google示例项目,可以在我的VS2015上运行,但是我发布到“IIS”并托管后,当我打开链接时,网页一直显示如图所示的消息我将key添加到web.config中,但仍然不起作用,只是想知道以前是否有人这样做过,我真的需要帮助,谢谢!编辑:这是我的代码Web.Config 最佳答案 在运行时以编程方式设置环境变量:stringcredential_path=@"C:\..\key.json";System.Environment.SetEnvironmentVariable("GOOGLE_APPLICATION_

c# - 将 Application Insights 与 ILoggerFactory 结合使用

我正在尝试将异常记录到ApplicationInsights。我通过直接调用TelemetryClient.TrackException成功地做到了这一点。但是,我想在我的代码中对此进行抽象,以防将来我想登录到其他平台,因此我只想坚持使用ILogger接口(interface)。我发现您可以使用ILoggerFactory.AddApplicationInsights(已实现here),但无论我做了什么,我都没有看到日志显示在ApplicationInsights中。下面是我的代码:Startup.csIConfigurationRootConfiguration{get;set;}I

c# - 控制台应用程序中的 Application.Current "null"

我目前正在尝试使用WPF组件,该组件利用WPF应用程序中的Application.Current,但是由于多种原因,我从不调用Application.Run(也不是一个选项)。结果是NullReferenceException。我主要是想从一个控制台应用程序中显示同一个WPF窗口的多个实例。欢迎任何建议(以及C#/F#中的代码示例)!提前致谢 最佳答案 只是提供一个替代解决方案。可以在不打开任何窗口的情况下保持应用程序运行。对我来说,这感觉不那么“hackish”。:)http://msdn.microsoft.com/en-us/

c# - 在内容资源上调用的 Application.GetResourceStream 仍然返回 null

下面是VS2010项目(WindowsPhone)结构中与任务相关的部分:正在从DummyMediaLibProvider.cs执行代码:publicclassDummyMediaLibProvider:IMediaLibProvider{...StreamResourceInfoalbumArtPlaceholder=Application.GetResourceStream(newUri("../Images/artwork.placeholder.png",UriKind.Relative));artwork.placeholder.pngBuildAction设置为Conten

c# - 系统参数异常 : Complex DataBinding accepts as a data source either an IList or an IListSource

我正在使用下面的C#代码来填充WinFormsListBox。但是我想隐藏所有系统文件夹。例如$RecyclingBin。但它给了我以下错误。System.ArgumentException:ComplexDataBindingacceptsasadatasourceeitheranIListoranIListSource.作为LINQ的新手,这让我很困惑。谁能告诉我哪里出错了?string[]dirs=Directory.GetDirectories(@"c:\");vardir=fromdindirswhere!d.StartsWith("$")selectd;listBox.Da