• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 14221
  • Last Modified:

Inconsistent accessibility: property type X is less accessible than property Y

I am trying to add the C# event below to a custom control.  However I am getting the follwing error, please help.

Inconsistent accessibility: property type 'CA.UI.CustomControls.uccPostalCodeSearchEditor.SelectedItemHandler' is less accessible than property 'CA.UI.CustomControls.uccPostalCodeSearchEditor.SelectedItem'

//Definitions for the SelectedItem Event
//SelectedItem event is raised when the user selects a Record.
delegate void SelectedItemHandler(object sender, PostalCodeSearchEditorSelectedEventArgs e);
private SelectedItemHandler SelectedItemEvent;
public event SelectedItemHandler SelectedItem
{
      add
      {
            SelectedItemEvent = (SelectedItemHandler) System.Delegate.Combine(SelectedItemEvent, value);
      }
      remove
      {
                               SelectedItemEvent = (SelectedItemHandler) System.Delegate.Remove(SelectedItemEvent, value);
      }
}  // END: public event SelectedItemHandler SelectedItem


Also below is the working VB code:

Delegate Sub SelectedItemHandler(ByVal sender As Object, ByVal e As PostalCodeSearchEditorSelectedEventArgs)
Public Event SelectedItem As SelectedItemHandler
0
wenyonk
Asked:
wenyonk
  • 2
1 Solution
 
Bob LearnedCommented:
It means that you can't expose an internal member from a public member:

public delegate void SelectedItemHandler(object sender, PostalCodeSearchEditorSelectedEventArgs e);

Bob
0
 
Bob LearnedCommented:
I try to get in the habit of always specifying scope modifiers to all declarations, like classes, properties, events, etc.

Bob
0
 
wenyonkAuthor Commented:
Thank you LearnedOne!
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now