小编sda*_*nna的帖子

使用LINQ进行多次排序

我从一个基本类开始,我想使用LINQ在List中操作,如下所示:

public class FooBar   
{  
    public virtual int Id { get; set; }  
    public virtual string Foo{ get; set; }  
    public virtual string Bar{ get; set; }
}
Run Code Online (Sandbox Code Playgroud)

这是我最终发现使用非lambda LINQ的东西来解决我的问题.

// code somewhere else that works and gets the desired results  
var foobarList = GetFooBarList();  // Abstracted out - returns List<Foobar>  

// Interesting piece of code that I want to examine
var resultSet = from foobars in foobarList  
                orderby foobars.Foo, foobars.Bar  
                select foobars;

// Iterate and do something interesting  
foreach …
Run Code Online (Sandbox Code Playgroud)

c# linq lambda

216
推荐指数
1
解决办法
16万
查看次数

VS2008到VS2010项目转换

我在VS2008中构建了一个组件项目,目标是.NET Framework 3.5.我最近下载了VS2010 Beta 1,以确保在切换到新IDE时该项目能够正确转换.该项目包含对框架版本2.0构建的几个第三方dll的引用.我改变了我的项目以构建框架的4.0版本但是当我尝试构建项目时,我得到了大量错误,看起来编译器无法识别类似于下面的第三方库的类类型.

"命名空间'Microsoft.Practices.EnterpriseLibrary'中不存在类型或命名空间名称'Data'(您是否缺少程序集引用?)"

我想弄清楚为什么我无法编译.从我读到的内容来看,.NET 4.0使用了不同版本的CLR.如何或为何会影响我访问这些类型的能力?我是否必须这样做

a)获取源代码并在VS2010/.NET 4.0中重新编译,然后引用该程序集或

b)等待项目作者在上面做"a"并发布针对4.0 CLR的程序集?要么

c)还有别的因为我的VS2010安装可能会被堵塞吗?

我可以将项目属性更改为目标3.5,一切都按照我在2010 IDE中的预期运行.

.net-4.0 visual-studio-2010

7
推荐指数
1
解决办法
6653
查看次数

无法从IIS中运行'dir'或'Get-ChildItem'命令:\来自powershell

我正在尝试自动执行一些Web应用程序部署任务,因此我尝试使用PowerShell来实现此目的.我有一个powershell脚本和一个.bat文件.批处理文件就在那里执行powershell脚本并包含此文本.我在Windows 8 - 64位.

C:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell.exe -NoProfile -ExecutionPolicy Bypass -Command "& '%~dp0\SetupWebServer.ps1' %*
Run Code Online (Sandbox Code Playgroud)

我在powershell脚本中有一些运行这些命令的代码:

Write-Host "Check for the existence of the Application Pool."
Import-Module WebAdministration
$iisAppPoolName = "SiteName"
$iisAppPoolDotNetVersion = "v4.0"
$iisAppName = "SiteName"

cd IIS:\AppPools\

if (!(Test-Path $iisAppPoolName -PathType Container))
{
     Write-Host "Creating Application Pool"
}
Run Code Online (Sandbox Code Playgroud)

当我到达CD IIS:\ AppPools\command时,我收到以下错误:

cd : Retrieving the COM class factory for component with CLSID {688EEEE5-6A7E-422F-B2E1-6AF00DC944A6} failed due to the
following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).
At line:1 char:1
+ …
Run Code Online (Sandbox Code Playgroud)

iis powershell windows-8

4
推荐指数
1
解决办法
2229
查看次数

标签 统计

.net-4.0 ×1

c# ×1

iis ×1

lambda ×1

linq ×1

powershell ×1

visual-studio-2010 ×1

windows-8 ×1