コンパイラ エラー CS0050
アクセシビリティに一貫性がありません。戻り値の型 'type' のアクセシビリティはメソッド 'method' よりも低く設定されています。
戻り値の型と、メソッドの仮パラメーター リストで参照されるそれぞれの型は、少なくともメソッド自体と同程度にアクセス可能である必要があります。 詳細については、「アクセス修飾子」を参照してください。
例
次の例では、MyClass
にアクセス修飾子が指定されていないため、アクセシビリティは既定の private
なので、CS0050 が生成されます。
// CS0050.cs
class MyClass // Accessibility defaults to private.
// Try the following line instead.
// public class MyClass
{
}
public class MyClass2
{
public static MyClass MyMethod() // CS0050
{
return new MyClass();
}
public static void Main() { }
}
Collaborate with us on GitHub
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide.
.NET feedback
The .NET documentation is open source. Provide feedback here.
フィードバック
フィードバックの送信と表示