This documentation is archived and is not being maintained.

Compiler Error CS0128 

Error Message

A local variable named 'variable' is already defined in this scope

The compiler detected declarations of two local variables with the same name. For more information, see Methods (C# Programming Guide).

The following sample generates CS0128:

// CS0128.cs
namespace MyNamespace
{
   public class MyClass
   {
      public static void Main()
      {
         char i;
         int i;   // CS0128
      }
   }
}
Show: