方法“<methodname1>”无法实现分部方法“<methodname2>”,因为“<methodname3>”已经实现了它

更新:2007 年 11 月

错误消息

方法“<methodname1>”无法实现分部方法“<methodname2>”,因为“<methodname3>”已经实现了它。只有一个方法可以实现分部方法。

不能具有两个实现相同分部方法声明的分部方法。下面的代码导致此错误。

Partial Class Product

    ' Declaration of the partial method.
    Partial Private Sub ValueChanged()
    End Sub

End Class
Partial Class Product

    ' First implementation of the partial method.
    Private Sub ValueChanged()
        MsgBox(Value was changed to " & Me.Quantity)
    End Sub

    ' Second implementation of the partial method causes this error.
    'Private Sub ValueChanged()
    '    Console.WriteLine("Quantity was changed to " & Me.Quantity)
    'End Sub

End Class

**错误 ID:**BC31434

请参见

概念

分部方法