草庐IT

parallel-systems

全部标签

c# - 无法加载文件或程序集 'System.Web.Mvc, Version=3.0.0.0' 或其依赖项之一

我在包管理器控制台中使用以下命令在MVC项目中添加Ninject:Install-PackageNinject-version3.0.1.10Install-PackageNinject.Web.Common-version3.0.0.7Install-PackageNinject.MVC3-Version3.0.0.6当我运行应用程序时,出现如下错误:Couldnotloadfileorassembly'System.Web.Mvc,Version=3.0.0.0,Culture=neutral,PublicKeyToken=31bf3856ad364e35'oroneofitsde

c# - 找不到源类型 'System.Data.Entity.DbSet' 的查询模式的实现

我是第一次使用EntityFramework,但它似乎没有按预期工作。我有这个代码:usingSystem;usingSystem.Collections.Generic;usingSystem.Data.Entity;usingSystem.Linq;publicstaticclassQueryClass{publicstaticvoidQuery(){using(varcontext=newMyDbEntities()){DbSetset=context.Tables;varquery=fromvalinsetselectvalue;}}}在查询行上(正是“set”变量用红色下划线

c# - List<Object> 上的 Parallel.ForEach 线程安全

就线程安全而言,可以这样做还是我需要使用不同的集合?ListfileInfo=getList();Parallel.ForEach(fileInfo,fileMember=>{//ModifyeachfileMember} 最佳答案 只要您只是修改传递给方法的项目的内容,就不需要锁定。(当然前提是列表中没有重复引用,即对同一FileMemberEntity实例的两个引用。)如果需要修改列表本身,创建一个可以迭代的副本,修改列表时使用锁:ListfileInfo=getList();Listcopy=newList(fileInfo)

c# - 使用 Parallel.ForEach() 线程安全吗?

本质上,我正在处理这个:vardata=input.AsParallel();Listoutput=newList();Parallel.ForEach(data,line=>{StringoutputLine="";//**Dosomethingwith"line"andstoreresultin"outputLine"**//Additionally,therearesomethis.InvokestatementsforupdatingUIoutput.Add(outputLine);});输入是List目的。ForEach()语句对每个值进行一些处理,更新UI,并将结果添加到o

c# - 如何在 Parallel.For 中配置最大线程数

这是微软为并行for提供的示例,我想知道如何为这段代码配置最大线程数。//Abasicmatrixmultiplication.//Parallelizetheouterlooptopartitionthesourcearraybyrows.System.Threading.Tasks.Parallel.For(0,matARows,i=>{for(intj=0;j 最佳答案 您需要指定一个ParallelOptions具有MaxDegreeOfParallelism的值:例如:Parallel.For(0,10,newParall

c# - 在 32 位和 64 位 C# 世界中使用 System.Data.SQLite 的选项

我理解为什么在32位和64位版本中提供System.Data.SQLite.dll。因此,让我们不要纠缠于此并继续前进。:)因为它是以这种方式完成的,所以它似乎使纯C#开发变得更加困难,因为要做出3个选择。是只支持32位并强制在那里管理程序集编译x86并处理在32或64中运行位,当您使用64位时会失去优势环境。是强制64位,只支持64位,丢了能够在32位上运行,但获得64位的所有优势。是创建两个版本的程序集编译x86并使用32位SQLite和另一个编译x64并使用64位SQLite。它阻止使用“ANY”作为编译选项并且能够轻松地将单个构建部署到任何一种类型。它的从开发的角度来看,管理起

c# - 找不到 System.Data.Entity.SqlServer.SqlProviderServices、EntityFramework.SqlServer

我正在从SqlConnection构建DbContext。当我使用它时,我收到以下错误:TheEntityFrameworkprovidertype'System.Data.Entity.SqlServer.SqlProviderServices,EntityFramework.SqlServer,Version=6.0.0.0,Culture=neutral,PublicKeyToken=b77a5c561934e089'forthe'System.Data.SqlClient'ADO.NETprovidercouldnotbeloaded.我使用的是6.0.0-alpha2-112

c# - 如何将类型 System.Collections.Specialized.StringCollection 转换为字符串 []

我的类库中的一些函数接受string[]作为参数。我想将我的System.Collections.Specialized.StringCollection转换为string[]。有没有可能只用一个衬里,或者我必须用循环创建数组? 最佳答案 使用StringCollection.CopyTo(string[],index)将内容复制到字符串数组。所有.Net框架都支持这一点。System.Collections.Specialized.StringCollectionsc=newSystem.Collections.Specializ

c# - 为什么 System.Web.HttpUtility.UrlEncode 给出的命名空间名称在 Visual C# 2008 中不存在?

我正在尝试使用HttpUtility.UrlEncode()方法对URL进行编码,为什么我会得到Thetypeornamespacename'HttpUtility'doesnotexistinthenamespace'System.Web'(areyoumissinganassemblyreference?)错误?我使用的是VisualC#2008速成版。我使用的代码很简单:usingSystem;usingSystem.Text;usingSystem.Windows.Forms;usingSystem.Net;usingSystem.IO;usingSystem.Web;name

c# - 在 Hibernate 和 Sleep 之后,System.Timers.Timer 在 WPF 应用程序中的行为如何?

我在WPF应用程序中使用System.Timers.Timer。我想了解Timer在计算机休眠和sleep后的行为方式。在计算机从休眠状态恢复后,我的应用程序出现了一些奇怪的问题。我应该如何处理计时器,当计算机处于休眠/sleep模式时它们的行为如何?我有一个午夜计时器,它应该在每个午夜工作以重置UI上的默认值。下面是创建定时器的代码:privatevoidResetMidnightTimer(){//killtheoldtimerDisposeMidnightTimer();_midnightTimer=newTimer();//schedulingthetimertoelapse1