草庐IT

item_property

全部标签

c# - 验证错误 : The value 'on' is not valid for <<property name>>

在我的项目中,我有一个模型,您可以在这里看到我模型的一部分:publicclassCheckoutModel{publicboolOtherPlace{get;set;}[RequiredIf("OtherPlace",true,ErrorMessage="")]publicstringOtherPlaceFullName{get;set;}[RequiredIf("OtherPlace",true,ErrorMessage="")]publicintOtherPlaceProvinceId{get;set;}[RequiredIf("OtherPlace",true,ErrorMes

c# - LINQ to Entities 无法识别方法 'System.String get_Item (System.String)' ,

我该如何解决这个问题?这是我的代码:DateTimedtInicio=newDateTime();DateTimedtFim=newDateTime();Int32codStatus=0;if(!string.IsNullOrEmpty(collection["txtDtInicial"]))dtInicio=Convert.ToDateTime(collection["txtDtInicial"]);if(!string.IsNullOrEmpty(collection["txtDtFinal"]))dtFim=Convert.ToDateTime(collection["txtDt

c# - 执行非查询 : Connection property has not been initialized.

下午,所以我已经在这个问题上研究了几个小时,但无法真正克服最后一个障碍。下面是我正在编写的这个程序的代码:usingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Text;usingSystem.Diagnostics;usingSystem.Data;usingSystem.Data.SqlClient;usingSystem.Configuration;namespaceTest{classProgram{staticvoidMain(){EventLogalog=newEventLog();

c# - CA1819 : Properties shouldn't return arrays - What is the right alternative?

我以前遇到过这个FxCop规则,但对如何解决违规问题并不满意(thread1、thread2)。我现在有另一个案例,我需要纠正违反CA1819的行为亲切。具体来说,我有一个算法库,它使用如下所示的公共(public)“输入对象”对曲线(x,y)执行一些分析计算:publicclassInputObject{publicdouble[]X{get;set;}publicdouble[]Y{get;set;}//+lotsofotherthingswell}此对象的X和Y属性在库中的数百个位置使用,通常使用索引。输入对象永远不会被算法改变,但实际上如果是这样也无关紧要。另外,.Length

c# - ASP.NET MVC3 中的 Razor 和接口(interface)继承 : why can't this property be found?

我在ASP.NETMVC3应用程序中的一个RazorView有一个奇怪的问题。当我将其值写入调试器控制台时,该属性似乎确实存在,但我收到一条错误消息,告诉我无法找到该属性。我的View将一个名为FormEditViewModel的类作为其模型。FormEditViewModel有一个IForm类型的属性,一个继承自另一个接口(interface)IFormObject的接口(interface)。IFormObject定义了一个属性Name,因此任何实现IForm的东西都必须实现一个名为Name的属性。具体类型Form实现接口(interface)IForm并根据需要定义Name属性。

c# - 奇怪的 Queue<T>.Enqueue(T item) 代码

在使用ILSpy进行反射时,我在Queue.Enqueue(Titem)中找到了这行代码-方法:if(this._size==this._array.Length){intnum=(int)((long)this._array.Length*200L/100L);if(num我只是想知道为什么有人会这样做?我认为这是某种整数溢出检查,但为什么要先乘以200L然后除以100L?这可能是早期编译器的问题吗? 最佳答案 通常先乘以再除以100是百分比计算-也许在原始代码中有一些constXxxPercentage=200或类似的东西。编译

c# - HttpContext.Current.Items 的范围

当Server.Transfer();发生时,HttpContext.Current.Items是否丢失?如果是这样,我将信息发送到另一个页面的最佳方式是什么不通过session? 最佳答案 是的,上下文仍然有效。如果您使用Response.Redirect(),它将变得无效或中断。参见文章TheHttpContextItemsCollection 关于c#-HttpContext.Current.Items的范围,我们在StackOverflow上找到一个类似的问题:

c# - MSBuild 未处理的异常 : The FileName property should not be a directory unless UseShellExecute is set

版本dotnet核心SDK:2.1.403docker:18.09.7Linux内核:5.0.0-27Ubuntu:18.04.3问题我正在docker中运行一个ASP.NETCore项目。当我docker-composeup时,我得到以下信息:UnhandledException:Microsoft.Build.BackEnd.NodeFailedToLaunchException:TheFileNamepropertyshouldnotbeadirectoryunlessUseShellExecuteisset.--->System.ComponentModel.Win32Exce

c# - Visual Studio 中的 "Add existing item": is it possible to make "Add as link" default?

正如this中指出的那样因此,VisualStudio中的Add>Existingitem对话框默认显示Add按钮(意味着所选项目将被物理复制到新位置),而理想的操作通常(总是?)添加为链接。是否可以配置VisualStudio,以便在打开添加>现有项目对话框时默认选择添加为链接?我已经彻底搜索了VisualStudio中的Options对话框并检查了MSDN文档以找到对此的答案,但到目前为止无济于事。ProjectLinker当两个新项目要共享同一代码库时,自动链接是一个不错的选择。但是,当将大量文件从现有项目链接到新项目时,似乎仅限于Add>Existingitem方法,而且这项工

c# - 如何解决 ReSharper 仅针对显示/值成员的属性的 "unused property"警告?

我已经为一个对象定义了两个属性,“Name”和“ID”,我将其用于具有BindingList数据源的ComboBox的DisplayMember和ValueMember。我最近安装了ReSharper来评估它。ReSharper在对象上向我发出警告,指出这两个属性未被使用。示例代码:BindingListSampleList=newBindingList();//populateSampleListcmbSampleSelector.DisplayMember="Name";cmdSampleSelector.ValueMember="ID";cmbSampleSelector.Dat