Visual Studio 2010 C#"已经定义了具有相同参数类型错误的成员."

Wil*_*ahl 3 c# parameters types member defined

即时通讯在视觉工作室有问题,它一直说我已经定义了一个具有相同参数类型的成员.我是C#编程的新手,我真的不知道该怎么做.这些是正在发生的错误:

错误1类型'Secret.AddPage'已经定义了一个名为'AddPage'的成员,其成员具有相同的参数类型

错误2类型'Secret.AddPage'已经定义了一个名为'PhoneApplicationPage_Loaded'的成员,其成员具有相同的参数类型

这是我到目前为止所写的代码,非常感谢任何帮助.

enter code here

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.Device.Location;

namespace secret
{
public partial class AddPage : PhoneApplicationPage
{
    private string location = "";

    public AddPage()
    {
        InitializeComponent();

        GeoCoordinateWatcher myWatcher = new GeoCoordinateWatcher();
        var myPosition = myWatcher.Position;

        // Eftersom koden körs i emulatorn kan den inte få tillgång till riktiga GPS-värden
        // Därför hårdkodas koordinaterna till slottet i Gamla stan så att MSR MAPS Web Services
        //kan testas.

        double latitude = 40.717;
        double longitude = -74;

        if (!myPosition.Location.IsUnknown)
        {
            latitude = myPosition.Location.Latitude;
            longitude = myPosition.Location.Longitude;
        }

        myTerraService.TerraServiceSoapClient client = new myTerraService.TerraServiceSoapClient();

        client.ConvertLonLatPtToNearestPlaceCompleted += new EventHandler<myTerraService.ConvertLonLatPtToNearestPlaceCompletedEventArgs>(client_ConvertLonLatPtToNearestPlaceCompleted);

        client.ConvertLonLatPtToNearestPlaceAsync(new myTerraService.LonLatPt { Lat = latitude, Lon = longitude });
    }

    void client_ConvertLonLatPtToNearestPlaceCompleted(object sender, myTerraService.ConvertLonLatPtToNearestPlaceCompletedEventArgs e)
    {
        location = e.Result;

        //throw new NotImplementedException();
    }


    private void AppBar_Cancel_Click(object sender, EventArgs e)
    {
        navigateBack();
    }

    private void AppBar_Save_Click(object sender, EventArgs e)
    { // spara en ny anteckning

        if (location.Trim().Length == 0)
        {
            location = "Okänd";
        }

        navigateBack();

    }
    private void navigateBack()
    {
        NavigationService.Navigate(new Uri("/secret;component/NotesMainPage.xaml", UriKind.Relative));
    }

    private void PhoneApplicationPage_Loaded(object sender, RoutedEventArgs e)
    {
        editTextBox.Focus();

    }
}
}
Run Code Online (Sandbox Code Playgroud)

Hab*_*bib 12

您正在创建一个分部类,因此您可能在部分类的另一个源文件中定义了这些成员.

您可以查看解决方案资源管理器,找到该源文件并从中删除它,或者您可以从当前的分部类中删除这些成员.

您可能会看到:部分类和方法(C#编程指南)

要搜索包含分部类的其他源文件,请右键单击"类名" AddPage并选择Go to Definition.您将在visual studio中的"查找符号"结果窗口中看到多个结果.