This documentation is archived and is not being maintained.

Compiler Error CS0761

Visual Studio 2008

Partial method declarations of 'method<T>' have inconsistent type parameter constraints.

If a partial method has an implementation, the generic type constraint must be identical to the constraint defined on the method signature.

To correct this error

  • Make the generic type constraints identical on each part of the partial method.

The following code generates CS0761:

// cs0761.cs
using System;

public partial class C
{
    partial void Part<T>() where T : class;
    partial void Part<T>() where T : struct // CS0761
    {
    }

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