错误DownloadStringCompletedEventHandler

时间:2011-03-08 12:45:07

标签: c# windows-phone-7

我不明白错误在哪里......

using System.Xml.Linq;
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;


namespace xmldow
{
    public partial class MainPage : PhoneApplicationPage
    {
        // Constructor
        public MainPage()
        {
            InitializeComponent();
        }

        private void clickBott(object sender, RoutedEventArgs e)
        {
            WebClient client = new WebClient();
            client.DownloadStringCompleted += new DownloadStringCompletedEventHandler(client_DownloadStringCompleted);
            client.DownloadStringAsync(new Uri("http://example.net/ddd/my.xml"));

        }

        void client_DownloadStringCompleted(Object sender, DownloadStringCompletedEventHandler e)
        {
            throw new NotImplementedException();


        }
    }
}

这是错误:

  

错误1“client_DownloadStringCompleted”没有重载匹配委托“System.Net.DownloadStringCompletedEventHandler”

感谢

1 个答案:

答案 0 :(得分:6)

client_DownloadStringCompleted方法应该是这样的:

private void client_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
{
    throw new NotImplementedException();
}