F# tail recursive call

I have this code: let rec collect ( t : BCFile list ) ( acc : Set<BCFile> ) : Set<BCFile> = match t with | [] -> acc | hr::tl -> collect ( tl ) ( Set.union acc ( FindSourceFilesForTarget ( hr ) ) ) let s = collect (Set.toList targets) Set.empty It looks like it should be tail recursive, but it is not (looking at IL). Any idea why it is not compiled to use tail rec

F#尾递归调用

我有这样的代码: let rec collect ( t : BCFile list ) ( acc : Set<BCFile> ) : Set<BCFile> = match t with | [] -> acc | hr::tl -> collect ( tl ) ( Set.union acc ( FindSourceFilesForTarget ( hr ) ) ) let s = collect (Set.toList targets) Set.empty 它看起来应该是尾递归,但它不是(看着IL)。 任何想法为什么它没有编译使用尾递归? 据我所知, collect函数实际上是尾递归的

Regex to match anything but two words

I'm trying to write a regular expression to match anything that isn't "foo" and "bar". I found how to match anything but one word at Regular expression to match a line that doesn't contain a word? but I'm not very skilled with regex and am unsure of how to add a second word to this critera. Any help would be most appreciated! CLARIFICATION: I wanted to

正则表达式只能匹配两个单词

我试图写一个正则表达式来匹配任何不是“foo”和“bar”的东西。 我发现如何在正则表达式中匹配除了一个单词之外的任何内容,以匹配不包含单词的行? 但我对于正则表达式并不熟练,我不确定如何在这个标准中添加第二个单词。 非常感激任何的帮助! 澄清: 我想匹配任何不是完全富有或不合适的东西。 回答这个问题:“一个正则表达式匹配任何不是”foo“和”bar“的东西?” ^(?!foo$|bar$).* 会做到这一点。 ^ # Start of

Case insensitive string compare in LINQ

I've read that it's unwise to use ToUpper and ToLower to perform case-insensitive string comparisons, but I see no alternative when it comes to LINQ-to-SQL. The ignoreCase and CompareOptions arguments of String.Compare are ignored by LINQ-to-SQL (if you're using a case-sensitive database, you get a case-sensitive comparison even if you ask for a case-insensitive comparison). Is ToLo

在LINQ中不区分大小写的字符串比较

我读过使用ToUpper和ToLower执行不区分大小写的字符串比较是不明智的,但是在涉及到LINQ-to-SQL时我看不到其他选择。 String.Compare的ignoreCase和CompareOptions参数被LINQ-to-SQL忽略(如果您使用的是区分大小写的数据库,即使您要求区分大小写的比较,也可以区分大小写)。 ToLower或ToUpper是最佳选择吗? 这个比那个好吗? 我以为我在某处读到ToUpper更好,但我不知道这是否适用于此。 (我正在做很多代码评论,每个

What does the Visual Studio "Any CPU" target mean?

I have some confusion related to the .NET platform build options in Visual Studio 2008. What is the "Any CPU" compilation target, and what sort of files does it generate? I examined the output executable of this "Any CPU" build and found that they are the x86 executables (who would not see that coming!). So, is there any the difference between targeting executable to x86 v

Visual Studio“Any CPU”目标是什么意思?

我有一些与Visual Studio 2008中的.NET平台构建选项有关的混淆。 什么是“任何CPU”编译目标,它会生成什么样的文件? 我检查了这个“任何CPU”构建的输出可执行文件,并发现它们是x86可执行文件(谁不会看到它!)。 那么,将可执行文件定位到x86与“任何CPU”之间有什么区别? 我注意到的另一件事是托管的C ++项目没有这个平台作为选项。 这是为什么? 这是否意味着我怀疑“任何CPU”可执行文件是纯32位的可执行文件是正确的?

capturing group not working in Regex

Using regex, I want to match the following strings: January 25 Jan 25 I'm capturing month and date parts separately but want to return only the first 3 characters of month name if there's full month name, so I'm using non-capturing group (?:) for the characters "uary": (?<M>(Jan(?:uary)?)) (?<D>dd) Unfortunately, the group M always returns full month name; i

捕获不在Regex中工作的组

使用正则表达式,我想匹配以下字符串: January 25 Jan 25 我分别捕获月份和日期部分,但如果有完整的月份名称,只想返回月份名称的前3个字符,所以我对字符“uary”使用非捕获组(?:) : (?<M>(Jan(?:uary)?)) (?<D>dd) 不幸的是, M组总是返回完整的月份名称; 即它也捕获非捕获组。 我已打开ExplicitCapture标志。 我已经使用RegExBuilder和Rad Software的正则表达式设计器来确保它不是因为该工具。 您的捕

How do you enable "Enable .NET Framework source stepping"?

Update 22nd Feb 2013 : The Microsoft Connect entry has note from Alok Shriram (Program Manager, Base Class Libraries, .NET Framework) that the issue should now be resolved. The Connect entry is marked as Resolved (Fixed): This issue should now be fixed. We published an update to reference sources. Please let us know in case your issue is still not fixed. Year and a half. Bonus Links Vo

你如何启用“启用.NET Framework源码步进”?

更新2013年2月22日 :Microsoft Connect条目已经从Alok Shriram(程序管理器,基类库,.NET Framework)注意到现在应该解决该问题。 连接条目标记为已解决(固定): 现在应该修复这个问题。 我们发布了对参考资料的更新。 如果您的问题仍未解决,请告诉我们。 一年半。 奖金链接 表决该错误在Microsoft Connect上修复。 微软社交网络已经持续了一年半的时间,询问它什么时候会修复。 原始问题 如何在Visual St

Debug with an incompatible Visual Studio, but with .pdb

Okay, weird situation: I need to Debug a VSTO Office Addin. This was written in Visual Studio 2008 Professional and debugging is usually done by loading the Project, Attaching to Outlook.exe and setting breakpoints - works fine. But I gave a situation where it does not work as expected on one machine, but I do not have VS2008 Pro on that Machine (only Express if that helps, but express will no

使用不兼容的Visual Studio调试,但使用.pdb

好吧,奇怪的情况:我需要调试一个VSTO Office Addin。 这是用Visual Studio 2008 Professional编写的,调试通常通过加载项目,附加到Outlook.exe和设置断点来完成 - 工作正常。 但是我给出了一台机器无法按预期工作的情况,但我没有在该机器上使用VS2008 Pro(只有Express有帮助,但由于不支持Project类型,Express不会加载该项目),并且不支持使用远程调试器的机会。 我只是想知道是否仍然可以在不加载项目的情况下进行

AutoMapper Profiles and Unit Testing

I'm rolling over my AutoMappers from using one large AutoMapperConfiguration class to using actual profiles. Global now looks like so (forgive the Open/Close violation for now) Mapper.Initialize(x => { x.AddProfile<ABCMappingProfile>(); x.AddProfile<XYZMappingProfile>(); // et

AutoMapper配置文件和单元测试

我从使用一个大的AutoMapperConfiguration类到使用实际配置文件的AutoMapper。 全球现在看起来像这样(原谅现在的开放/关闭违规) Mapper.Initialize(x => { x.AddProfile<ABCMappingProfile>(); x.AddProfile<XYZMappingProfile>(); // etc., etc. }); 让我超越顶级的关键是以前一

Is MVC RESTful by design

Does MVC have to be RESTful? Is there a way to make a SOAP service using MVC pattern? Would the input request actually go into the View first and then into the Controller then the Model eg: Request -> View -> Controller -> Model but in doing so, that's no longer MVC pattern. (that's right isn't it?) How else would we get a typed response using SOAP but still adhere t

MVC RESTful由设计

MVC必须是RESTful吗? 有没有办法使用MVC模式来制作SOAP服务? 输入请求是否会首先进入View ,然后进入Controller然后是Model例如: Request -> View -> Controller -> Model 但是这样做,这不再是MVC模式。 (这是对的不是吗?) 我们还会如何使用SOAP获得类型化的响应,但仍然坚持(或接近) MVC模式。 相反,MVVM会更适合这种情况吗? REST描述了如何与应用程序交互,而MVC则是如何实现应用程序。 使用

.NET DropDownList SelectedIndexChange Event Not Firing in IE 10

In IE 10, when a drop down list selected item is changed, nothing happens. It doesn't post back. All other controls work except for drop down lists. It appears to work when I switch to IE 10 compatibility mode. Scott Hanselman explains this on his blog. http://www.hanselman.com/blog/BugAndFixASPNETFailsToDetectIE10CausingDoPostBackIsUndefinedJavaScriptErrorOrMaintainFF5ScrollbarPositi

.NET DropDownList SelectedIndexChange事件不在IE 10中触发

在IE 10中,当下拉列表中选择的项目被更改时,什么都不会发生。 它不回发。 除下拉列表外,其他所有控件都可以使用。 当我切换到IE 10兼容模式时它似乎工作。 Scott Hanselman在他的博客中解释了这一点。 http://www.hanselman.com/blog/BugAndFixASPNETFailsToDetectIE10CausingDoPostBackIsUndefinedJavaScriptErrorOrMaintainFF5ScrollbarPosition.aspx 您是否安装了用于IE10的ASP.net修补程序? 好的,这是一个奇