Compiler Error CS0750
TOC
Collapse the table of content
Expand the table of content
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer

Compiler Error CS0750

Visual Studio 2008

A partial method cannot have access modifiers or the virtual, abstract, override, new, sealed, or extern modifiers.

Because of their special behavior, partial methods are subject to restrictions as to the modifiers they can accept.

To correct this error

  • Remove the unauthorized modifier from the method declaration.

The following example generates CS0750:

// cs0750.cs
using System;

public class Base
{
    protected virtual void PartG()
    {
    }

    protected void PartH()
    {
    }
    protected virtual void PartI()
    {
    }
}

public partial class C:Base
{
    // All these partial method declarations
    // will generate CS0750.
    public partial void PartA();
    private partial void PartB();
    protected partial void PartC();
    internal partial void PartD();
    virtual partial void PartE();
    abstract partial void PartF();
    override partial void PartG();
    new partial void PartH();
    sealed override partial void PartI();
    extern partial void PartJ();

    public static int Main()
    {
        return 1;
    }
}
Show:
© 2016 Microsoft