C# Compiler Error
CS0264 – Partial declarations of ‘type’ must have the same type parameter names in the same order
Reason for the Error
You’ll get this error in your C# code when you are trying to define a generic type when declaring partial types and the parameter types are not consistent in name across the partial type declaration.
For example, lets try to compile the below code snippet.
using System; namespace DeveloperPubNamespace { public partial class class1<Type1> { } public partial class class1<Type2> { } class Program { public static void Main() { Console.WriteLine("Welcome"); } } }
You’ll receive the error code CS0264 when you try to build the above C# program because you have declared multiple generic partial types “class1” but each one of these have a different parameter type.
Error CS0264 Partial declarations of ‘class1’ must have the same type parameter names in the same order DeveloperPublish C:\Users\Senthil\source\repos\ConsoleApp3\ConsoleApp3\Program.cs 5 Active
Solution
You can fix this error in your C# code by ensuring that the type parameters for each of the partial type that you have declared has same name and the same order of parameters.