草庐IT

abstract_target

全部标签

c# - C++/命令行界面 : How do I declare abstract (in C#) class and method in C++/CLI?

以下C#代码在C++/CLI中的等价物是什么?publicabstractclassSomeClass{publicabstractStringSomeMethod();} 最佳答案 只需稍微混合关键字即可获得正确的语法。abstract在C#中位于前面,但在C++/CLI中位于末尾。与override关键字相同,今天也被C++11兼容的编译器识别,它们期望它位于函数声明的末尾。就像传统C++中的=0标记函数抽象一样:publicrefclassSomeClassabstract{public:virtualString^SomeM

c# -/平台 :anycpu32bitpreferred is not a valid setting for option/target:library or/target:module

我创建了一个Windows服务项目,后来决定将其输出类型更改为类库,这样我就可以将服务类包含在另一个项目中,该项目将创建要作为服务安装的.exe。但是现在,当我尝试构建第一个项目时,它失败并出现错误:/platform:anycpu32bitpreferredisnotavalidsettingforoption/target:libraryor/target:module我该如何解决这个问题? 最佳答案 尝试卸载项目(在解决方案资源管理器中右键单击)编辑.csproj(右键单击解决方案资源管理器)删除true重新加载项目。

c# - MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets(3243,9) : error MSB4094

在VSUltimate201312.0.21005.1REL中打开我的VSUltimate2012C#解决方案后,我收到以下警告:Warning1Foundconflictsbetweendifferentversionsofthesamedependentassembly.Pleasesetthe"AutoGenerateBindingRedirects"propertytotrueintheprojectfile.Formoreinformation,seehttp://go.microsoft.com/fwlink/?LinkId=294190.EnergyMS我遵循Micros

c# - TCP 错误代码 10061 : No connection could be made because the target machine actively refused it

很难说出这里要问什么。这个问题模棱两可、含糊不清、不完整、过于宽泛或夸夸其谈,无法以目前的形式得到合理的回答。如需帮助澄清此问题以便重新打开,visitthehelpcenter.关闭9年前。Couldnotconnecttonet.tcp://localhost:5051/user.Theconnectionattemptlastedforatimespanof00:00:02.0600206.TCPerrorcode10061:Noconnectioncouldbemadebecausethetargetmachineactivelyrefusedit127.0.0.1:5051.

c# - .NET 属性生成 "must declare a body because it is not marked abstract or extern"编译错误

我有一个.NET3.5(目标框架)网络应用程序。我有一些看起来像这样的代码:publicstringLogPath{get;privateset;}publicstringErrorMsg{get;privateset;}它给我这些行的编译错误:"mustdeclareabodybecauseitisnotmarkedabstractorextern."有什么想法吗?我的理解是这种风格的属性在.NET3.0中是有效的。谢谢!原来问题出在我的.sln文件本身。尽管我在构建选项中更改了目标版本,但在.sln文件中,我发现了这一点:TargetFramework="3.0"将其更改为“3.5

c# - 错误 : *. csproj 无法在 MonoDevelop 上导入 "$(MSBuildBinPath)\Microsoft.CSharp.targets"

因此,我在LinuxMint16上安装了MonoDevelopv5.7。我创建了带有默认代码的新C#ConsoleProjectusingSystem;namespaceLab1{classMainClass{publicstaticvoidMain(string[]args){Console.WriteLine("HelloWorld!");}}}并尝试构建它F7。之后出现错误:错误:/../../Lab1/Lab1/Lab1.csproj:/../../Lab1/Lab1/Lab1.csproj无法导入“$(MSBuildBinPath)\Microsoft.CSharp.targ

C# 设计 : Why is new/override required on abstract methods but not on virtual methods?

为什么抽象方法需要new/override而虚方法不​​需要?示例1:abstractclassShapesClass{abstractpublicintArea();//abstract!}classSquare:ShapesClass{intx,y;publicintArea()//Error:missing'override'or'new'{returnx*y;}}编译器会显示这个错误:要使当前成员覆盖该实现,请添加override关键字。否则添加新关键字示例2:classShapesClass{virtualpublicintArea(){return0;}//itisvirt

c# - .NET C# : WebBrowser control Navigate() does not load targeted URL

我正在尝试通过WebBrowser控件以编程方式加载网页,目的是测试页面及其JavaScript函数。基本上,我想将通过此控件运行的HTML和JavaScript与已知输出进行比较,以确定是否存在问题。但是,我在简单地创建和导航WebBrowser控件时遇到了麻烦。下面的代码旨在将HtmlDocument加载到WebBrowser.Document属性中:WebBrowserwb=newWebBrowser();wb.AllowNavigation=true;wb.Navigate("http://www.google.com/");在Navigate()运行后通过Intellisen

c# - : "exception was thrown by the target of invocation" C#如何解决

C#每次我运行我的程序时,我都会得到这个异常:但是当我在Debug模式下运行时,没有异常,程序运行正常,我该怎么办?注意:我没有在项目的任何地方使用invoke()编辑:好的,这是在详细信息中找到的代码:如果有人知道如何使用protoBuff,并且知道这个问题....**************ExceptionText**************System.Reflection.TargetInvocationException:Exceptionhasbeenthrownbythetargetofaninvocation.--->ProtoBuf.ProtoException:I

c# - PropertyInfo 实例上的 SetValue 错误 "Object does not match target type"c#

在以前的项目中的不同地方使用了带有这段代码的Copy方法(处理具有相同命名属性但不派生自公共(public)基类或实现公共(public)接口(interface)的对象)。新的工作地点,新的代码库-现在即使在非常简单的示例中,它也会在SetValue处失败并显示“对象与目标类型不匹配”......并且它在上周工作......publicstaticvoidCopy(objectfromObj,objecttoObj){TypefromObjectType=fromObj.GetType();TypetoObjectType=toObj.GetType();foreach(System