草庐IT

four_days_have_passed

全部标签

c# - Linq To SQL 和 Having

我是LinqToSQL的新手,但我试图运行一个应该相当简单的SQL查询,但无法弄清楚如何让它在LINQ中发挥良好的作用。SELECTUsers.Id,Users.IdASExpr1,Users.FirstName,Users.LastName,User_x_Territory.UserIDFROMUsersLEFTOUTERJOINUser_x_TerritoryONUser_x_Territory.UserID=Users.IdGROUPBYUsers.Id,Users.Id,Users.FirstName,Users.LastName,User_x_Territory.UserID

c# - OOPS 概念 : What is the difference in passing object reference to interface and creating class object in C#?

我有一个类CustomerNew和一个接口(interface)ICustomer:publicclassCustomerNew:ICustomer{publicvoidA(){MessageBox.Show("Classmethod");}voidICustomer.A(){MessageBox.Show("Interfacemethod");}publicvoidB(){MessageBox.Show("ClassMethod");}}publicinterfaceICustomer{voidA();}我对这两行代码很困惑。ICustomerobjnew=newCustomerNe

c# - 是否 AvalonEdit :TextEditor have quick search/replace functionality?

我使用AvalonEdit:TextEditor。我可以为此控件启用快速搜索对话框(例如在Ctrl-F上)吗?或者也许有人有将搜索词输入AvalonEdit:TextEditor文本的代码? 最佳答案 关于它的文档不多,但AvalonEdit确实有一个内置的SearchPanel听起来完全像你想要的类。甚至还有一个SearchInputHandler类使得将它连接到您的编辑器、响应键盘快捷键等变得微不足道。下面是一些将标准搜索逻辑附加到编辑器的示例代码:myEditor.TextArea.DefaultInputHandler.Ne

c++-cli - C++/CLI-问题: Is there an equivalent to the C# "is" keyword or do I have to use reflection?

我在MSDN的某个地方读到过,与C#的“is”关键字等效的是dynamic_cast,但这并不完全等效:它不适用于值类型或泛型参数。例如在C#中我可以写:voidMyGenericFunction(){objectx=...if(xisT)...;}如果我尝试“等效的”C++/CLI:genericvoidMyGenericFunction(){objectx=...if(dynamic_cast(x))...;}我收到编译器错误“errorC2682:cannotuse'dynamic_cast'toconvertfrom'System::Object^'to'T'”。我唯一能想到的

c# - 无法远程调试 .Net 应用程序 "no symbols have been loaded for this document."

我正在尝试调试.Net应用程序。我将它(和.pdb)复制到VM。我能够附加到进程,但我的断点在附加后被禁用:“当前不会命中断点,没有为该文档加载任何符号。”我确信虚拟机上的PDB是正确的。我尝试将主机上的PDB路径添加到visualstudio的符号路径。我错过了什么?(Win7x86、VisualStudio10、.Net4)谢谢 最佳答案 问题是PDB文件必须放在VM和主机上的同一文件夹中。 关于c#-无法远程调试.Net应用程序"nosymbolshavebeenloadedfor

c# - DI Framework : how to avoid continually passing injected dependencies up the chain, 且未使用服务定位器(特别是使用 Ninject)

我需要更多帮助才能“了解”像Ninject这样的DI框架如何超越基础知识。以Ninject为例:classSamurai{privateIWeapon_weapon;[Inject]publicSamurai(IWeaponweapon){_weapon=weapon;}publicvoidAttack(stringtarget){_weapon.Hit(target);}}如果没有DI框架(即上面的[Inject]引用),引用类将类似于:classProgram{publicstaticvoidMain(){Samuraiwarrior1=newSamurai(newShuriken

c# - ClickOnce 应用程序错误 : Deployment and application do not have matching security zones

我在IE中使用FireFox和Chrome的ClickOnce应用程序时遇到问题,它工作正常。异常的详细信息是:PLATFORMVERSIONINFOWindows:6.1.7600.0(Win32NT)CommonLanguageRuntime:4.0.30319.239System.Deployment.dll:4.0.30319.1(RTMRel.030319-0100)clr.dll:4.0.30319.239(RTMGDR.030319-2300)dfdll.dll:4.0.30319.1(RTMRel.030319-0100)dfshim.dll:4.0.31106.0(M

C# 编译器错误 : "cannot have instance field initializers in structs"

我需要有关结构的建议。我有两段代码。第一部分如下:namespaceProject.GlobalVariables{classIOCard{structInputCard{publicstringCardNo;publicintBaseAddress;publicintLowerAddress;publicintUpperAddress;publicint[]WriteBitNo=newint[16];publicint[]ReadBitNo=newint[16];}staticInputCard[]InputCards=newInputCard[5];publicstaticstri

c# - 试图允许空值但是... "Nullable object must have a value"

我试图在我的下拉列表中允许空值,在我的数据库表中我已经为特定的int字段设置了允许空值,但是当我运行代码时我收到错误消息“可为空的对象必须有一个值”,我认为问题可能出在ModelState中。Controller[HttpPost]publicActionResultEdit(Studentstudent){if(ModelState.IsValid){db.Entry(student).State=EntityState.Modified;db.SaveChanges();Loanw=newLoan(){StudentID=student.StudentID,ISBN=student

c# - 在C#中将字符串解析为 "year-month-day"格式

我正在使用需要以下格式“2010-12-24”的日期时间的网络服务我有字符串以相同的“方式”解析,但如前所述,它是一个字符串。stringmyDate="2010-12-24";我怎样才能解析它以得到相同的格式?尝试使用:DateTime.Parse(mystring);但这给了我一个冒号分隔的格式。 最佳答案 使用DateTime.ParseExact,提供customformatstring:DateTime.ParseExact(mystring,"yyyy-MM-dd",CultureInfo.InvariantCultur