草庐IT

set_charset

全部标签

c# - 如何使用 AMD Display Library (ADL) Overdrive State Set 功能(以编程方式超频)

我正在使用AMDDisplayLibrary这基本上允许我们控制GPU的某些参数(时钟速度/风扇控制)。SDK附带一个Sample-Managed代码,我能够从ADL_Overdrive6_StateInfo_Get方法获得所需的结果(核心和内存时钟速度)。使用ADL_Overdrive6_State_Set方法(具有相同的参数)返回错误代码:intod_result=ADL.ADL_Overdrive6_State_Set(OSAdapterInfoData.ADLAdapterInfo[i].AdapterIndex,ADL.ADL_OD6_SETSTATE_PERFORMANCE

c# - "Property set method not found"反射时出错

我正在尝试反射(reflect)一些类属性并以编程方式设置它们,但看起来我的PropertyInfo过滤器之一不起作用://Getallpublicorprivatenon-staticpropertiesdeclaredinthisclass(noinheritedproperties)-thathaveagetterandsetter.PropertyInfo[]props=this.GetType().GetProperties(BindingFlags.DeclaredOnly|BindingFlags.Instance|BindingFlags.Public|BindingF

c# - MemoryCache.Set() 是线程安全的吗?

MSDNdocumentationforMemoryCache.Set不幸的是没有明确说明它是否是线程安全的。在没有显式锁定的情况下从多个线程使用.Get()和.Set()是否安全? 最佳答案 是的,MemoryCache类isthreadsafe:System.Runtime.Caching.MemoryCacheisthreadsafe.MultipleconcurrentthreadscanreadandwriteaMemoryCacheinstance.Internallythread-safetyisautomatical

c# - 代码优先迁移 : How to set default value for new property?

我正在使用EF6在我的数据库中存储report类的实例。数据库已包含数据。假设我想向report添加一个属性,publicclassreport{//...somepreviousproperties//...newproperty:publicstringnewProperty{get;set;}}现在,如果我转到包管理器控制台并执行add-migrationReport-added-newPropertyupdate-database我将在“/Migrations”文件夹中获取一个文件,将newProperty列添加到表中。这很好用。但是,在数据库中的旧条目上,newPropert

c# - VS 2017 : The security debugging option is set but it requires the Visual Studio hosting process which is unavailable

我的解决方案(包含十几个项目)在VisualStudio2013中完美运行。在VisualStudio2017中,我可以打开解决方案并进行编译。但如果我开始调试,我会系统地收到此错误消息:ThesecuritydebuggingoptionissetbutitrequirestheVisualStudiohostingprocesswhichisunavailableinthisdebuggingconfiguration.Thesecuritydebuggingoptionwillbedisabled.Thisoptionmaybere-enabledintheSecuritypro

c# - 多线程场景调用Dictionary对象的set_item方法抛出NullReferenceException

我们的网站有一个配置页面,比如“config.aspx”,页面初始化的时候会从一个配置文件中加载一些信息。为了缓存加载的信息,我们提供了一个工厂类,并在页面加载时调用工厂的公共(public)方法来获取配置实例。但有时当应用程序池重新启动时,我们会在事件日志中发现一些错误消息,如下所示:Message:Objectreferencenotsettoaninstanceofanobject.Stack:atSystem.Collections.Generic.Dictionary`2.Insert(TKeykey,TValuevalue,Booleanadd)atSystem.Colle

C# 自动属性 ​​- 为什么我必须写 "get; set;"?

如果在C#自动属性中get和set都是强制性的,为什么我还要费心指定“get;set;”有没有? 最佳答案 因为你可能想要一个只读属性:publicintFoo{get;privateset;}或者只写属性:publicintFoo{privateget;set;} 关于C#自动属性​​-为什么我必须写"get;set;"?,我们在StackOverflow上找到一个类似的问题: https://stackoverflow.com/questions/3405

c# - WPF-MVVM : Setting UI control focus from ViewModel

在MVVM架构中设置控制焦点的最佳做法是什么。我设想的方式是在ViewModel上使用一个属性,该属性会在需要时触发焦点更改。而不是让UI控件绑定(bind)/监听该属性,以便在它发生变化时设置适当的焦点。我将其视为ViewModel事物,因为我想在ViewModel执行特定操作(例如加载特定数据)后适当设置焦点。最佳做法是什么? 最佳答案 按照此处答案中的建议使用IsFocused附加属性:SetfocusontextboxinWPFfromviewmodel(C#)然后您可以简单地绑定(bind)到View模型中的属性。

c# - Properties.Settings.Default 的数据保存在哪里?

在我的WPF应用程序中,我在解决方案资源管理器中单击Settings.settings并输入一个具有User范围的StringCollection变量:在我的app.config中,我看到它们保存在那里:onetwothreefourfivesixseven然后我运行我的应用程序并使用以下代码:StringCollectionpaths=Properties.Settings.Default.Paths;Properties.Settings.Default.Paths.Add("addedincode");Properties.Settings.Default.Save();fore

c# - 为什么 Property Set 会抛出 StackOverflow 异常?

我懂java,通常会使用getter/setter方法。我有兴趣使用以下代码在C#中执行此操作,但它会引发StackOverflow异常。我做错了什么?调用代码c.firstName="a";属性代码publicStringfirstName;{get{returnfirstName;}set{firstName=value;}} 最佳答案 这是因为您正在递归地调用该属性-在set中您再次设置该属性,它会一直无限直到您炸毁堆栈。您需要一个私有(private)支持字段来保存值,例如privatestringfirstName;pub