locked
Inconsistent accessibility: base class

    Question

  • Trying to derive a class from KeyedCollection, I keep getting the following error:

    Inconsistent accessibility: base class 'System.Collections.ObjectModel.KeyedCollection<string,Dell.Global.PartsClass.DBObjects.InvThreshold>' is less accessible than class 'Dell.Global.PartsClass.DBObjects.InvThresholdList'

    Here's the code, it's pretty much straight from the sample in the KeyedCollection documentation:

    using System;

    using System.Collections.Generic;

    using System.Collections.ObjectModel;

    using System.Text;

    namespace Dell.Global.PartsClass.DBObjects

    {

    public class InvThresholdList : KeyedCollection<string, InvThreshold>

    {

    public InvThresholdList() : base()

    {

    }

    protected override string GetKeyForItem(InvThreshold objItem)

    {

    return objItem.AreaName + ":" + objItem.ClassificationName;

    }

    }

    }

     

    Anybody have any idea if this is a bug in the framework or if I'm just making some bonehead mistake?

    Tuesday, January 24, 2006 5:04 PM

Answers

  • Is InvThreshold an internal class by any chance, rather than public? That would certainly explain the compiler error. Fix it by either making InvThresholdList internal or by making InvThreshold public.

    Jon
    Tuesday, January 24, 2006 6:44 PM