Compiler Error CS0752
A partial method cannot have out parameters
A partial method cannot have an out parameter. Out parameters are not allowed because if the partial method is removed by the compiler then there is no guarantee that the out parameter is ever assigned.
- Remove the out modifier from the parameter and use the return value of the method instead, or else remove the partial modifier from the method declaration.
The following code generates CS0752:
C#
// cs0752.cs
public partial class C
{
partial void Part(out int num); // CS0752
// try the following line instead
// partial void Part(int num);
public static int Main()
{
return 1;
}
}
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.
.NET feedback
.NET is an open source project. Select a link to provide feedback: