I'm creating a database and I need to index the database for all the entries that match a name.
This is where it is being used:
dDatabase.FindAll(findArea.Match);
This is the findArea class:
public class FindArea
{
string m_Name;
public FindArea(string name)
{
m_Name = name;
}
public Predicate<databaseEntry> Match
{
get { return NameMatch; }
}
private bool NameMatch(databaseEntry deTemp)
{
if(deTemp.itemName == m_Name)
{
return true;
}
else
{
return false;
}
}
}
This is the stripped down functionality of the databaseEntry Class:
class databaseEntry
{
public databaseEntry(int id, int area, string name)
{
rfid = id;
currentArea = area;
itemName = name;
}
}
My problem is that when I try to compile this I get
"error CS0053: Inconsistent accessibility: property type 'System.Predicate<Database.databaseEntry>' is less accessible than property Database.FindArea.Match"
in the Predicate<databaseEntry> Match function.
UPDATE
So Thanks for all the help, I needed to set the access of the databaseEntry class to public,
i.e.
public class databaseEntry
or I could have changed the:
public class FindArea
to:
class FindArea
and leave the databaseEntry alone
This happened due to mixing different accessibility for the two classes
publicbut returnsdatabaseEntrywhich is internal. - Jeroen VanneveldatabaseEntry- leppieclass databaseEntryisn't public, which means that if you want to exposepublic Predicate<databaseEntry> Matchthen the export needs to know aboutdatabaseEntry. - Aron