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.
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
Your issue is that your databaseEntry class isn't public and hence for the predicate based on databaseEntry class to be public, you need to also make the databaseEntry class public.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With