草庐IT

system_timer

全部标签

c# - 已编译的单声道缺少默认 .NET 库 - 未定义或导入 System.Object

我已经按照位于此处的指南在OSXMavericks上编译了单声道:http://www.mono-project.com/docs/compiling-mono/mac/现在,当我使用xbuild编译我的应用程序时,出现以下错误:CSC:errorCS0518:Thepredefinedtype`System.Object'isnotdefinedorimportedCSC:errorCS0518:Thepredefinedtype`System.ValueType'isnotdefinedorimportedCSC:errorCS0518:Thepredefinedtype`Syst

c# - 如何将 GZipStream 与 System.IO.MemoryStream 一起使用?

我在使用内存字符串、压缩和解压缩时遇到此测试函数的问题。压缩效果很好,但我似乎无法进行解压。//CompressSystem.IO.MemoryStreamoutStream=newSystem.IO.MemoryStream();GZipStreamtinyStream=newGZipStream(outStream,CompressionMode.Compress);mStream.Position=0;mStream.CopyTo(tinyStream);//DecompressoutStream.Position=0;GZipStreambigStream=newGZipStr

c# - 如何将 GZipStream 与 System.IO.MemoryStream 一起使用?

我在使用内存字符串、压缩和解压缩时遇到此测试函数的问题。压缩效果很好,但我似乎无法进行解压。//CompressSystem.IO.MemoryStreamoutStream=newSystem.IO.MemoryStream();GZipStreamtinyStream=newGZipStream(outStream,CompressionMode.Compress);mStream.Position=0;mStream.CopyTo(tinyStream);//DecompressoutStream.Position=0;GZipStreambigStream=newGZipStr

c# - System.Web.HttpContextBase' 不包含带有 Elmah 日志记录的 'Current' MVC 4 的定义

我有一个C#ASP.NETMVC4项目,它使用Elmah来捕获任何未处理的异常。这在大多数情况下都很有效。但是我发现对于使用JQueryAjax调用调用的Controller方法,我无法获取当前上下文。例如,在我返回JsonResult的Controller方法中,我有这个测试代码;try{thrownewException("Thisisatest");}catch(Exceptione){Elmah.ErrorLog.GetDefault(HttpContext.Current).Log(newElmah.Error(e));}HttpContext.Current导致以下错误;'

c# - System.Web.HttpContextBase' 不包含带有 Elmah 日志记录的 'Current' MVC 4 的定义

我有一个C#ASP.NETMVC4项目,它使用Elmah来捕获任何未处理的异常。这在大多数情况下都很有效。但是我发现对于使用JQueryAjax调用调用的Controller方法,我无法获取当前上下文。例如,在我返回JsonResult的Controller方法中,我有这个测试代码;try{thrownewException("Thisisatest");}catch(Exceptione){Elmah.ErrorLog.GetDefault(HttpContext.Current).Log(newElmah.Error(e));}HttpContext.Current导致以下错误;'

c# - 缺少 System.ServiceModel

我在Win7(64位)上使用VS2010express,我正在尝试使用System.ServiceModel但我收到一个错误,指出没有ServiceModelSystem命名空间:Thetypeornamespacename'ServiceModel'doesnotexistinthenamespace'System'(areyoumissinganassemblyreference?)我查看了\Windows\Microsoft.NET\Framework\v4.0.30319并且有一些ServiceModel___.dll文件,但我不知道我是否缺少某些东西或它们是否已损坏。有什么建

c# - 缺少 System.ServiceModel

我在Win7(64位)上使用VS2010express,我正在尝试使用System.ServiceModel但我收到一个错误,指出没有ServiceModelSystem命名空间:Thetypeornamespacename'ServiceModel'doesnotexistinthenamespace'System'(areyoumissinganassemblyreference?)我查看了\Windows\Microsoft.NET\Framework\v4.0.30319并且有一些ServiceModel___.dll文件,但我不知道我是否缺少某些东西或它们是否已损坏。有什么建

c# - 将日期 yyyyMMdd 转换为 system.datetime 格式

这个问题在这里已经有了答案:关闭11年前。PossibleDuplicate:howtoconvertdatefromyyyyMMddformattomm-dd-yyyyfomrat我有一个string,其中包含yyyyMMdd格式的日期。我想使用ConvertTo.DateTime()方法或任何其他简单方法将该日期转换为系统日期格式。stringvalue="19851231";//yyyyMMddDateTimedateTime=1985/12/31;

c# - 将日期 yyyyMMdd 转换为 system.datetime 格式

这个问题在这里已经有了答案:关闭11年前。PossibleDuplicate:howtoconvertdatefromyyyyMMddformattomm-dd-yyyyfomrat我有一个string,其中包含yyyyMMdd格式的日期。我想使用ConvertTo.DateTime()方法或任何其他简单方法将该日期转换为系统日期格式。stringvalue="19851231";//yyyyMMddDateTimedateTime=1985/12/31;

c# - 可靠地停止 System.Threading.Timer?

好吧,我已经搜索了很多解决方案。我正在寻找一种干净简单的方法来防止System.Threading.Timer的回调方法在我停止后被调用。我似乎找不到任何东西,这导致我偶尔求助于可怕的thread-thread.sleep-thread.abort组合。可以用lock来实现吗? 最佳答案 一个更简单的解决方案可能是将Timer设置为永不恢复;方法Timer.Change可以为dueTime和period取值,指示计时器永不重启:this.Timer.Change(Timeout.Infinite,Timeout.Infinite);