Compiler Error CS0751
A partial method must be declared in a partial class or partial struct
It is not possible to declare a partial method unless it is encapsulated inside a partial class or partial struct.
To correct this error
- Either remove the
partial
modifier from the method and provide an implementation, or else add thepartial
modifier to the enclosing class or struct.
Example
The following example generates CS0751:
// cs0751.cs
using System;
public class C
{
partial void Part(); // CS0751
public static int Main()
{
return 1;
}
}
See also
Collaborate with us on GitHub
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide.
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for