Rav*_*avi 1 c# silverlight webclient windows-phone-7
我有一个简单的代码:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;
using System.IO;
public partial class WebClient : PhoneApplicationPage
{
public WebClient()
{
InitializeComponent();
}
private void button1_Click(object sender, RoutedEventArgs e)
{
WebClient webclient = new WebClient();
Run Code Online (Sandbox Code Playgroud)
现在,当我说webClient.,我希望在IntelliSense下拉列表中看到DownloadStringCompleted,但我没看到.当我强制使用它时,当然它不会编译.问题是什么?
我正在测试WebClient以查看它是否在我的项目中使用,因为我厌倦了异步调用和与HttpWebRequest相关联的多个线程
你有一些奇怪的原因使用名称"WebClient"作为你的类名PhoneApplicationPage.因此,当您使用此行时: -
WebClient webclient = new WebClient();
Run Code Online (Sandbox Code Playgroud)
它试图创建页面的另一个实例这当然不具有DownloadStringCompleted或其他任何由提供WebClient的System.Net命名空间.
我强烈建议你给你的页面一个不同的名字.如果你真的想把你的页面称为"WebClient",那么"WebClientPage"怎么样?
| 归档时间: |
|
| 查看次数: |
1987 次 |
| 最近记录: |