不提供给我的Silverlight应用程序的WebClient方法 [英] webclient methods not available to my Silverlight application
问题描述
试图做基本的Web客户端的数据拉在C#和方法不是在VisualStudio中可用,代码不编译。
Trying to do basic webclient data pull in C#, and the methods are not available in visualstudio, and the code is not compiling.
//snip
WebClient client = new WebClient();
byte[] resp = client.DownloadData(url);
//snip
错误1'System.Net.WebClient'不包含一个定义对于DownloadData',没有扩展方法'DownloadData接受型System.Net.WebClient'的第一个参数可以找到(是否缺少using指令或程序集引用吗?)C:\Users\Michael\ Documents\Visual工作室2008\Projects\search2\search2\MainPage.xaml.cs
Error 1 'System.Net.WebClient' does not contain a definition for 'DownloadData' and no extension method 'DownloadData' accepting a first argument of type 'System.Net.WebClient' could be found (are you missing a using directive or an assembly reference?) C:\Users\Michael\Documents\Visual Studio 2008\Projects\search2\search2\MainPage.xaml.cs
我在C#中的文件,这样做了XAML / Silverlight项目,但无法想象为什么会有所作为。我无法找到在网络上对这个问题的任何引用和我有类似这种工作的最后一个月的东西,但在常规的ASP.NET页面,而不是在Silverlight应用程序。
I'm doing this in a c# file for a XAML/Silverlight project, but can't imagine why that would make a difference. I can not find any reference to this issue on the web, and I had something similar to this working last month, but in a regular ASP.NET page, not in a Silverlight app.
推荐答案
Silverlight在.NET Framework的一个精简/紧凑型。请参见 MSDN的文档在Silverlight Web客户端,看看它有极少数的方法相比,其在完整的.NET框架的对应。
Silverlight has a stripped-down/compact version of the .NET Framework. See MSDN's documentation for the WebClient in Silverlight to see it has very few methods compared to its counterpart in the full .NET Framework.
这篇关于不提供给我的Silverlight应用程序的WebClient方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!