小编Vis*_*hnu的帖子

CLR无法从COM上下文0x3b2d70转换到COM上下文

在调试应用程序时,我收到以下错误.

CLR无法从COM上下文0x3b2d70过渡到COM上下文0x3b2ee0 60秒.拥有目标上下文/公寓的线程很可能是在非抽空等待或处理非常长时间运行的操作而不抽取Windows消息.这种情况通常会对性能产生负面影响,甚至可能导致应用程序变得无响应或内存使用量随时间不断累积.为了避免这个问题,所有单线程单元(STA)线程都应该使用抽取等待原语(例如CoWaitForMultipleHandles)并在长时间运行操作期间定期泵送消息.

为什么系统会抛出此错误.

c#

14
推荐指数
1
解决办法
2万
查看次数

using http response how to save the pdf files

I've written following code to get the content from a web page and save to the system. if the webpage is in html format i'm able to save it. if the web page is in pdf format i'm unable to save it. After saving if i opend the file blank pages are coming.

我想知道如何从响应中保存pdf文件.

HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(Url);
WebResponse response = request.GetResponse();
Stream stream = response.GetResponseStream();
StreamReader reader = new StreamReader(stream);
webContent = reader.ReadToEnd();
StreamWriter sw = new StreamWriter(FileName);
sw.WriteLine(webContent); …
Run Code Online (Sandbox Code Playgroud)

c#

5
推荐指数
2
解决办法
2万
查看次数

查找列表中特定项目的计数

我有List<String>1000个名字.我想找出以字母"S"开头的名字数.

什么是最好的选择呢?

c#

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

标签 统计

c# ×3