Compiler error CS0273
The accessibility modifier of the 'property_accessor' accessor must be more restrictive than the property or indexer 'property'
The accessibility modifier of the set/get accessor must be more restrictive than the property or indexer 'property/indexer'
This error occurs when the accessibility of the accessor you declared isn't less restrictive than the accessibility of the property or indexer.
To correct this error
Use the appropriate access modifier on either the property or the accessor. For more information, see Restricting Accessor Accessibility and Accessors.
Example
This sample contains an internal property with an internal set method. The following sample generates CS0273.
// CS0273.cs
// compile with: /target:library
public class MyClass
{
internal int Property
{
get { return 0; }
internal set {} // CS0273
// try the following line instead
// private set {}
}
}
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for