草庐IT

is_enum_class

全部标签

c# - Outlook 邮件项目 : How to distinguish whether mail is incoming or outgoing?

我正在用C#编写VSTOOutlook插件,我需要区分给定的MailItem是传入还是传出(或者两者都不是,例如草稿)。有什么万无一失的方法吗?我现在拥有的最佳解决方案是获取收件人、抄送和密件抄送列表,从事件帐户加载电子邮件地址,并检查这两个列表是否相交,但这对我来说似乎很脆弱,我希望有更好的解决方案.用例:我想获取电子邮件的相关日期,可以是ReceivedTime或SentOn,但要知道我应该使用哪一个,我需要知道邮件是已发送还是已收到。谢谢你的想法:) 最佳答案 来到这个页面是因为我在VBA中遇到了同样的问题。检查父文件夹很麻烦

c# - DDD : Enum like entities

我有以下数据库模型:**Persontable**ID|Name|StateId------------------------------1Joe12Peter13John2**Statetable**ID|Desc------------------------------1Working2Vacation领域模型将是(简化的):publicclassPerson{publicintId{get;}publicstringName{get;set;}publicStateState{get;set;}}publicclassState{privateintid;publicstri

c# - 通过反射仅获取当前类(class)成员

假设这段代码:usingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Text;usingSystem.Threading.Tasks;usingSystem.Reflection;namespaceTestFunctionality{classProgram{staticvoidMain(string[]args){//System.Reflection.Assembly.GetExecutingAssembly().LocationAssemblyassembly=Assembly.LoadF

c# - ReSharper 如何知道 "Expression is always true"?

检查以下代码:privatevoidFoo(objectbar){Typetype=bar.GetType();if(type!=null)//Expressionisalwaystrue{}}ReSharper声称type永远不会是null。这对我来说很明显,因为bar总是有一个类型,但ReSharper是如何知道的?它怎么知道方法的结果永远不会是null?Type不是结构,所以不可能是这样。而如果这个方法是我写的,那么返回值肯定可以是null(不一定是GetType,而是别的什么)。ReSharper是否足够聪明,知道只有那个特定方法的结果永远不会是null?(就像有一个永远不会返

C#/N 休眠 : Association references unmapped class

几个小时以来,我一直在努力解决这个NHibernate问题。我在网络和NHibernate文档上进行了广泛的研究,但我无法理解这个问题。我对NHibernate比较陌生,但很喜欢它。不过,在那种情况下,它让我发疯。我正在为网站编写一个小型“投票”模块。我有几个类(Poll、PollVote和PollAnswer)。主要的Poll是导致问题的原因。这就是类的样子:publicclassPoll{publicvirtualintId{get;set;}publicvirtualSiteSite{get;set;}publicvirtualstringQuestion{get;set;}pu

c# - cs0030 :Unable to generate a temporary class

我有一个Web服务,当我尝试生成它的对象时出现以下错误。"Unabletogenerateatemporaryclass(result=1).errorCS0030:Cannotconverttype'ShortSell.ShortSellRQOriginDestinationInformationFlightSegment[]'to'ShortSell.ShortSellRQOriginDestinationInformationFlightSegment'errorCS0030:Cannotconverttype'ShortSell.ShortSellRSOriginDestina

c# - Enum.ToString() 已弃用?

当我在VisualStudio中的Enum类型上键入.ToString()时,Intellisense显示通过ToString()(虽然它构建并工作正常)。这似乎表明Enum.ToString()在某种程度上已被弃用。这是真的?如果是,为什么? 最佳答案 采用IFormatProvider的Enum.ToString重载,ToString(IFormatProvider)和ToString(String,IFormatProvider),都已过时,因为无论如何都没有使用IFormatProvider。其他重载,ToString()和

c# - 错误 : Unable to evaluate expression because the code is optimized

我在我的asp.net应用程序中收到一个错误“无法评估表达式,因为代码已优化或native框架位于调用堆栈的顶部。”protectedvoidbtnCustomerProfile_Click(objectsender,EventArgse){try{Server.Transfer("CustomerProfile.aspx");}catch(Exceptionex){Response.Write(ex.ToString());}finally{}}搜索SO后,看到类似的帖子大多涉及response.redirect。我的代码使用的是server.transfer,我的应用程序也使用母版

c# - Visual Studio 2008 : Step to next line is very slow when debugging managed code

当通过F10逐行单步执行我的C#代码时,调试器需要一秒钟多的时间才能到达下一行。我试过删除所有监视和断点,但这没有任何区别。这正常吗?很长一段时间以来都是这样,所以我什至不记得这是不是更好了。我的开发计算机是一台四核机器,没有后台任务事件并且有足够的RAM。如果不正常,我还能尝试什么?它仍然可以使用,但是一个不那么迟钝的用户界面会很棒...... 最佳答案 可能发生的情况是,您在调用堆栈框架中有一个变量,该变量具有昂贵的.ToString方法。在2008年,无论窗口是否实际可见,调用堆栈窗口的数据都会在每一步重建。构建此窗口的一部分

c# - 公共(public)静态字符串 MyFunc() 上的 "Expected class, delegate, enum, interface or struct"错误。什么 's an alternative to "字符串”?

当我尝试使用以下静态函数时出现错误。错误:Expectedclass,delegate,enum,interface,orstruct函数(和类):namespaceMyNamespace{publicclassMyClass{//SomeotherstaticmethodsthatuseClasses,delegates,enums,interfaces,orstructspublicstaticstringMyFunc(stringmyVar){stringmyText=myVar;//DosomestuffwithmyTextandmyVarreturnmyText;}}}这导致