草庐IT

CUDNN_STATUS_INTERNAL_ERROR

全部标签

c# - 在 "Public"类中包含 "Internal"成员是否是一种糟糕的编程习惯?

如果我只保留声明为“内部”的类中的“protected”、“内部”和“私有(private)”成员(字段、方法、属性、事件),会不会更具体和合适?我在各种代码中看到过这种做法(在“内部”类中有“公共(public)”成员)所以只是想知道这是一种不好的做法还是有一些好处或优势。[只关注C#]感谢您的关注。 最佳答案 不一定。如果您想隐式实现一个接口(interface),那么公共(public)成员是完全可以接受的。但一般来说,如果类是内部类,则公共(public)成员没有多大意义。您不会受到伤害,因为您将无法在定义它的模块之外以强类

c# - Twitter API + OAuth : Can't send status updates, 获取 401

我正在尝试使用Twitter的API和OAuth发送状态更新(新推文)。我正在使用ShannonWhitley.NET代码示例http://www.voiceoftech.com/swhitley/?p=681(如TwitterAPI文档中所推荐)。我可以使用OAuth读取(GET)就好了,但是当我尝试通过http://twitter.com/statuses/update.xml(使用POST)发送状态更新时,它返回带有以下XML的401:/statuses/update.xmlRead-onlyapplicationcannotPOST我发誓我已经将我的应用程序设置为使用读写,Tw

c# - .mdf"failed with the operating system error 2(系统找不到指定的文件。)

protectedvoidregister_Click(objectsender,EventArgse){AddUser(userName.Text,password.Text,confirm.Text);}voidAddUser(stringname,stringpass,stringconfirm){Useru=newUser(name,pass,confirm);if(u.Valid){using(vardb=newSiteContext()){db.User.Add(u);db.SaveChanges();}}}}publicclassUser{publicintUserId{

c# - 我想念 C# 中 Visual Basic 的 "On Error Resume Next"。我现在应该如何处理错误?

在VisualBasic中,我只在程序头部编写了OnErrorResumeNext,整个项目中的错误都被抑制了。在C#中,我非常怀念这个特性。对每个过程的常用try-catch处理不仅非常耗时,而且会带来不良影响。如果遇到错误,即使已处理,代码也不会从错误发生的地方继续。使用OnErrorResumeNext,代码从错误点继续,仅跳过导致错误的函数调用。我还没有深入了解C#,但也许C#中存在比原始try-catch更好的错误处理。我还想知道发生错误的模块或函数名称以及错误消息中的行号。据我所知,Exception类不提供该功能。任何想法(管理,当然,不涉及我自己的应用程序中的任何流程类

c# - 如何找到asp :Login LoginError error type

当asp:Login控件的LoginError事件触发时,我如何找到错误发生的原因?是否有类似e.ErrorType的属性告诉我登录失败的原因?或者我是否必须像本教程中那样手动检查所有内容:http://www.asp.net/security/tutorials/validating-user-credentials-against-the-membership-user-store-cs或http://www.aspnettutorials.com/tutorials/controls/howto-errors-login-asp4-csharp.aspx

c# - 如果打开自定义错误,是否不会触发 global.asax Application_Error 事件?

如果您在Web配置中将自定义错误设置为RemoteOnly-这是否意味着global.asax中的MVC应用程序级错误事件-Application_Error不会因错误而触发?我刚刚注意到,当我的应用程序出现某个错误时,我正在远程查看该站点,但没有记录任何错误。但是,当我访问服务器上的应用程序并发生相同的错误时,会记录错误。这是自定义错误配置设置:编辑只是出于人们的兴趣——我最终完全关闭了自定义错误并在Application_Error中处理重定向,如下所示:protectedvoidApplication_Error(objectsender,EventArgse){Exceptio

c# - 系统.ComponentModel.Win32Exception : Access is denied Error

我正在使用C#代码启动和停止窗口服务,但出现此错误。System.ComponentModel.Win32Exception:Accessisdenied我的代码:publicvoidStartService(stringserviceName,inttimeoutMilliseconds){ServiceControllerservice=newServiceController(serviceName);try{TimeSpantimeout=TimeSpan.FromMilliseconds(timeoutMilliseconds);service.Start();service

c# - 错误 :An unknown error occurred while invoking the service metadata component. 无法生成服务引用

当尝试使用.netcore2.1rc1为WCF添加服务引用时,我遇到以下错误:Error:Anunknownerroroccurredwhileinvokingtheservicemetadatacomponent.Failedtogenerateservicereference我已经检查过,唯一的安全措施是传输,没有消息安全措施。日志如下:[05/24/201812:28:28],59,Importingwebservicemetadata...[05/24/201812:28:28],27,Numberofserviceendpointsfound:2[05/24/201812:2

c# - 混淆 : Internal, 保护和保护内部

这个问题在这里已经有了答案:关闭10年前。PossibleDuplicate:Whatisthedifferencebetween'protected'and'protectedinternal'?WhatisthedifferencebetweenPublic,Private,Protected,andNothing?代码如下:usingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Text;namespacetestanotherlib{publicclassA{internalvoidInt

c# - 编译器错误 : "error CS0307: The variable ' int' cannot be used with type arguments"

如果我有以下代码:privatevoidCheck(boola,boolb){}privatevoidCheck(inta,intb,intc,boolflag){Check(a(flag?c:b-10));}我在调用Check(int,int)时遇到编译时错误:errorCS0307:Thevariable'int'cannotbeusedwithtypearguments我也遇到了这些错误:errorCS0118:'b'isavariablebutisusedlikeatypeerrorCS0118:'a'isavariablebutisusedlikeatype为什么会出现这些错