草庐IT

The_constant_pool

全部标签

c# - 为什么我不能在范围内的 switch 语句中使用 "constant"?

使用这段代码:publicpartialclassForm1:Form{privatestaticreadonlyintTABCONTROL_BASICINFO=0;privatestaticreadonlyintTABCONTROL_CONFIDENTIALINFO=1;privatestaticreadonlyintTABCONTROL_ROLESANDSECURITY=2;privatestaticreadonlyintTABCONTROL_INACTIVEINFO=3;...intActiveTabPage=tabControlWorker.SelectedIndex;swit

c# - mscorlib.dll : Access to the path . 中发生类型为 'System.UnauthorizedAccessException' 的未处理异常。被拒绝

我正在尝试将文件写入一个存在的目录,该目录由我在G:\\中创建,即不是系统目录或根驱动器,就像这样File.WriteAllBytes(directoryPath.Replace("wav","mp3"),asBytesArray);但这给我抛出了这个异常:Anunhandledexceptionoftype'System.UnauthorizedAccessException'occurredinmscorlib.dllAdditionalinformation:Accesstothepath'G:\Song'isdenied.我该如何解决这个问题?请帮忙!这是在我从VisualSt

c# - CodeContracts : Boolean condition evaluates to a constant value, 为什么?

我收到此警告但无法找出问题...CodeContracts:warning:TheBooleanconditiond1.Count!=d2.Countalwaysevaluatestoaconstantvalue.Ifit(oritsnegation)appearinthesourcecode,youmayhavesomedeadcodeorredundantcheck代码如下:publicstaticboolDictionaryEquals(IDictionaryd1,IDictionaryd2){if(d1==d2)returntrue;if(d1==null||d2==null)

c# - 来自 Visual Studio 2013 RC 的 "Cannot find or open the PDB file"

第一次使用C#,但我有Java经验。我写了一个HelloWorld程序来启动自己,但是我在编译时遇到了这个找不到或打开PDB文件错误。'ConsoleApplication4.vshost.exe'(CLRv2.0.50727:ConsoleApplication4.vshost.exe):Loaded'C:\Windows\assembly\GAC_64\mscorlib\2.0.0.0__b77a5c561934e089\mscorlib.dll'.CannotfindoropenthePDBfile.'ConsoleApplication4.vshost.exe'(CLRv2.0

c# - "The breakpoint will not currently be hit. A copy of file was found in dll file, but the current source code is different"

我不断收到此错误消息,提示存在.cs文件的副本,因此不会命中断点。我尝试过清理解决方案、重建、删除obj和bin文件夹中的.pdb文件、关闭VS并重新启动它、重新启动整个机器(这是Windows!有时最复杂、无法解释的问题会像这样解决:\)知道我还能尝试什么吗?这是VS2015上的.net项目 最佳答案 我发现了问题,原来IIS配置为使用我备份文件夹中项目的不同副本。这听起来很傻,但如果有人有类似的问题,我会保留这个问题。 关于c#-"Thebreakpointwillnotcurren

c# - NHibernate - KeyNotFoundException : The given key was not present in the dictionary

更新:我已经解决了这个问题我有下面的代码块,它最终应该更新一条记录if(session.Contains(entity)){session.Evict(entity);}Session.Evict(entity)上的哪些错误带有KeyNotFoundException,以及以下消息:Thegivenkeywasnotpresentinthedictionary.我是不是误会了什么?我假设如果session.Contains(entity)为真,那么key应该存在,因此session.Evict()应该按预期工作?堆栈轨迹如下:System.Collections.Generic.Key

c# - Visual Studio 变得疯狂 : 'The directory name is invalid' error when trying to compile

出于一些非常奇怪的原因,我的VisualStudio2008在尝试编译C#项目时尝试将可执行文件的输出写入与可执行文件同名的目录,至少看起来这就是错误所在消息暗示。在我的任何项目上运行编译后,CSC.EXE报告以下编译器错误:Couldnotwritetooutputfile'D:\Projects\Examples\StringBuilderVsString\obj\Release\StringBuilderVsString.exe'--'Thedirectorynameisinvalid.'当我查看obj\Release或obj\Debug时,所有中间资源(如StringBuild

c# - "Both use the XML type name X, use XML attributes to specify a unique XML name and/or namespace for the type"怎么解决?

我有以下枚举定义...namespaceItemTable{publicenumDisplayMode{Tiles,Default}}namespaceEffectiveItemPermissionTable{publicenumDisplayMode{Tree,FullPaths}}...然后我有以下类(class)...publicclassTablewhereTDisplayMode:struct{//publicpublicTDisplayModeDisplayMode{get{returnmDisplayMode;}set{mDisplayMode=value;}}//pri

c# - Facebook 登录抛出“应用程序配置不允许给定的 URL。: One or more of the given URLs is not allowed

我知道这个问题已经被问过很多次了,但是尽管我尝试了几个url地址,它似乎仍然会抛出这个错误。我正在尝试像微软教程中那样通过asp.netmvc应用程序登录facebookhere.当我在本地主机上检查它时它工作正常(Facebook中的站点URL设置为:http://localhost:55797/但是当我将应用程序上传到服务器后尝试检查它时,它给了我这个错误:GivenURLisnotallowedbytheApplicationconfiguration.:OneormoreofthegivenURLsisnotallowedbytheApp'ssettings.Itmustmat

c# - JWT 错误 IDX10634 : Unable to create the SignatureProvider C#

我正在尝试运行我的应用程序,但它因以下错误而卡住:System.NotSupportedExceptionHResult=0x80131515Message=IDX10634:UnabletocreatetheSignatureProvider.Algorithm:'[PIIishiddenbydefault.Setthe'ShowPII'flaginIdentityModelEventSource.cstotruetorevealit.]',SecurityKey:'[PIIishiddenbydefault.Setthe'ShowPII'flaginIdentityModelEve