Export (0) Print
Expand All
Expand Minimize

Compiler Error CS0751

Visual Studio 2008

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 the partial modifier to the enclosing class or struct.

The following example generates CS0751:

// cs0751.cs
using System;

public class C
{
    partial void Part(); // CS0751
    public static int Main()
    {
        return 1;
    }
}

Community Additions

ADD
Show:
© 2014 Microsoft