C# Error
CS0757 – A partial method may not have multiple implementing declarations
Reason for the Error & Solution
A partial method may not have multiple implementing declarations.
A partial method consists of exactly one defining declaration (signature) and one or zero implementing declarations (body). Multiple implementing declarations for the same identical defining declarations are not allowed. Partial methods may be overloaded, and each overloaded version may have one or zero implementing declarations.
To correct this error
- Remove all except one of the implementing declarations for the partial method.
Example
The following example generates CS0757:
// cs0757.cs
using System;
public partial class C
{
// Defining declaration.
partial void Part();
// Implementing declaration.
partial void Part()
{
//...Do something.
}
// Second implementing declaration.
partial void Part() // CS0757
{
//...Do something.
}
public static int Main()
{
return 1;
}
}