What is the difference between IQueryable<T> and IEnumerable<T>?

What is the difference between IQueryable<T> and IEnumerable<T> ? See also What's the difference between IQueryable and IEnumerable that overlaps with this question. First of all, IQueryable<T> extends the IEnumerable<T> interface, so anything you can do with a "plain" IEnumerable<T> , you can also do with an IQueryable<T> . IEnumerable<T

IQueryable <T>和IEnumerable <T>有什么区别?

IQueryable<T>和IEnumerable<T>什么区别? 另请参见与此问题重叠的IQueryable和IEnumerable之间的区别。 首先, IQueryable<T>扩展IEnumerable<T>接口,所以任何你可以用“简单” IEnumerable<T>做的事情,你也可以用IQueryable<T> 。 IEnumerable<T>只是一个GetEnumerator()方法,它返回一个Enumerator<T> ,您可以调用它的MoveNext()方法遍历一个T的序列。 IQueryable&

AutomationProperties.Name VS x:Name

There is no difference for the "CodedUI test builder" between the AutomationProperties.Name and x:Name . But the first one can override the second one. Also the AtomationProperties.Name supports data binding, x:Name of course doesn't. As we know if you are using the MVVM pattern it is best to only use x:Name when needed. So should AutomationProperties.Name be preferred to x:Na

AutomationProperties.Name VS x:名称

AutomationProperties.Name和x:Name之间的“CodedUI测试生成器”没有区别。 但第一个可以覆盖第二个。 AtomationProperties.Name也支持数据绑定, x:Name当然不支持。 我们知道如果您使用的是MVVM模式,最好只在需要时使用x:Name 。 那么AutomationProperties.Name应该优先于x:Name吗? 概要 x:Name和AutomationProperties.Name是两个完全不同的东西,所以“我应该使用其中一个还是另一个”这个问题是基于一个错误的前提:

Html.Partial vs Html.RenderPartial & Html.Action vs Html.RenderAction

In ASP.NET MVC, what is the difference between: Html.Partial and Html.RenderPartial Html.Action and Html.RenderAction Html.Partial returns a String. Html.RenderPartial calls Write internally and returns void . The basic usage is: // Razor syntax @Html.Partial("ViewName") @{ Html.RenderPartial("ViewName"); } // WebView syntax <%: Html.Partial("ViewName") %> <% Html.RenderParti

Html.Partial与Html.RenderPartial&Html.Action与Html.RenderAction

在ASP.NET MVC中,有什么区别: Html.Partial和Html.RenderPartial Html.Action和Html.RenderAction Html.Partial返回一个String。 Html.RenderPartial调用内部Write并返回void 。 基本用法是: // Razor syntax @Html.Partial("ViewName") @{ Html.RenderPartial("ViewName"); } // WebView syntax <%: Html.Partial("ViewName") %> <% Html.RenderPartial("ViewName"); %> 在上面的代码片段中,两个

missing Embed Interop Type property

In one C# project, I get the following warning: warning CS1762: A reference was created to embedded interop assembly 'Interop.SomeLibrary.dll' because of an indirect reference to that assembly created by assembly 'ALibraryOfMine.dll'. Consider changing the 'Embed Interop Types' property on either assembly. However, in the C# project that gives this warning, I do not s

缺少Embed Interop Type属性

在一个C#项目中,我收到以下警告: 警告CS1762:由于间接引用由程序集“ALibraryOfMine.dll”创建的程序集,因此创建了嵌入式互操作程序集“Interop.SomeLibrary.dll”的引用。 考虑更改任一程序集上的“Embed Interop Types”属性。 但是,在发出此警告的C#项目中,我没有在COM库引用属性中看到Embed Interop Types属性。 这在VS 2010中。在VS 2008的ALibraryOfMine项目中,相同的COM库也没有Embed Interop Types属性。 我怎

Finding my main executable's path using Assembly vs AppDomain

I'm a .NET user, and my goal is as simple as finding the absolute path of the directory of my main executing assembly (the EXE file). I have several candidates: Assembly.GetExecutingAssembly().CodeBase Assembly.GetExecutingAssembly().Location AppDomain.CurrentDomain.BaseDirectory If to judge by the .NET documentation - I'm leaning towards CodeBase . Can anyone shed light over a

使用Assembly vs AppDomain查找我的主要可执行文件的路径

我是.NET用户,我的目标就像寻找我主要执行程序集(EXE文件)的目录的绝对路径一样简单。 我有几个候选人: Assembly.GetExecutingAssembly().CodeBase Assembly.GetExecutingAssembly().Location AppDomain.CurrentDomain.BaseDirectory 如果要通过.NET文档进行判断 - 我倾向于CodeBase 。 任何人都可以比.NET文档更具体地阐述所有三种方法吗? 一个例子来证明这种差异? 我会使用GetEntryAssembly()而不是GetExe

Using app.config with a class library

Frequently I need to create a .Net class library that requires an app.config for things such as database connection strings. However, these settings must be in the calling application's app.config or web.config. If I want to distribute the DLL across multiple applications it becomes a pain because I have to copy these settings into each the application's app.config. I have considered

使用app.config和类库

我经常需要创建一个.Net类库,它需要一个app.config来处理诸如数据库连接字符串之类的东西。 但是,这些设置必须位于调用应用程序的app.config或web.config中。 如果我想要将DLL分布到多个应用程序中,这会变得非常痛苦,因为我必须将这些设置复制到每个应用程序的app.config中。 我已经考虑过通过代码从类库中手动读取配置设置,但这也是一个很大的麻烦。 有没有人有任何建议加载类库中的app.config设置的最佳方式? 你

String.Join vs. StringBuilder: which is faster?

In a previous question about formatting a double[][] to CSV format, Marc Gravell said that using StringBuilder would be faster than String.Join . Is this true? Short answer: it depends. Long answer: if you already have an array of strings to concatenate together (with a delimiter), String.Join is the fastest way of doing it. String.Join can look through all of the strings to work out the e

String.Join与StringBuilder:哪个更快?

在之前关于将double[][]格式化为CSV格式的问题中,Marc Gravell表示使用StringBuilder会比String.Join更快。 这是真的? 简短的回答:这取决于。 长答案: 如果你已经有一个字符串数组连接在一起(用分隔符), String.Join是最快的方法。 String.Join可以查看所有字符串以计算出所需的确切长度,然后再次复制并复制所有数据。 这意味着将不会涉及额外的复制。 唯一的缺点是它必须经过两次字符串,这意味着可能会使内存

Which exception terminates process ? (iis's w3wp)

I've read this article trying to find : "Which exceptions terminates the entire process" ( iis , so basically the application pool terminates - w3wp.exe ) I already know (from my experience) that : StackOverflow exceptions does terminates Outofmemory exceptions also terminates I already read Han's answer here which redirects to SSCLI20 source code where he gave an exampl

哪个异常终止进程? (iis的w3wp)

我读过这篇文章试图找到:“哪些异常终止了整个过程”(iis,所以基本上应用程序池终止 - w3wp.exe ) 我已经知道(从我的经验): StackOverflow异常会终止 外存异常也终止 我已经阅读了Han的答案,这里重定向到SSCLI20源代码,他给出了一个代码示例: TerminateProcess(GetCurrentProcess(), COR_E_STACKOVERFLOW); 所以我下载了SSCLI20并搜索了更多的TerminateProcess(GetCurrentProcess()... 并找到这些条目:

.NET 4 Windows service install upgrade error

I have a .NET 3.5 Windows service which is installed using a VS2008 Setup & Deployment project. It has a custom install action. The installation of this service worked great until I recently upgraded to VS2010/.NET 4. Now, when I upgrade to the new version, I get the install error: "Error 1001...BadImageFormatException: Could not load file or assembly...This assembly is built by a runt

.NET 4 Windows服务安装升级错误

我有一个使用VS2008安装和部署项目安装的.NET 3.5 Windows服务。 它有一个自定义安装操作。 这个服务的安装工作很好,直到我最近升级到VS2010 / .NET 4.现在,当我升级到新版本时,我得到安装错误:“Error 1001 ... BadImageFormatException:无法加载文件或程序集.. 。该程序集由比当前加载的运行时更新的运行时构建......“。 如果我卸载以前的版本,然后安装新版本,一切正常......没有错误。 正在我的开发机器上执行安装

Entity Framework 4 vs NHibernate

A lot has been talked about Entity Framework first version on the web (also on stackoverflow) and it is clear that it was not a good choice when we already have better alternative like NHibernate. But I can't find a good comparison of Entity Framework 4 and NHibernate. We can say that today NHibernate is the leader among all .NET ORMs, but can we expect Entity Framework 4 to displace NHiber

实体框架4与NHibernate

很多人已经在网络上讨论过Entity Framework的第一个版本(也是在stackoverflow上),很明显,当我们已经有了像NHibernate这样更好的选择时,这不是一个好的选择。 但我找不到实体框架4和NHibernate的比较。 我们可以说今天NHibernate是所有.NET ORM中的领导者,但我们可以期望Entity Framework 4从这个位置取代NHibernate。 我认为,如果微软真的在EF4中注入了非常好的功能,它可以给NHibernate带来很好的竞争力,因为它具有V