共用方式為


編譯器錯誤 CS0102

更新:2007 年 11 月

錯誤訊息

型別 'type name' 已經包含 'identifier' 的定義

類別包含多個在相同範圍內同名的多個識別項宣告。若要更正這個錯誤,請重新命名重複的識別項。

範例

下列範例會產生 CS0102。

// CS0102.cs
// compile with: /target:library
namespace MyApp
{
   public class MyClass
   {
      string s = "Hello";
      string s = "Goodbye";   // CS0102
      
      public void GetString()
      {
         string s = "Hello again";   // method scope, no error
      }
   }
}