ShowOrders throws an error: ‘ShowOrders.ShowOrders (string)’ is inaccessible due to its protection level (CS0122) [Project_Geolab]
else if ("R" == command)
{
Console.WriteLine ("Enter Name");
var email = Console.ReadLine ();
new ShowOrders (email) .Show ();
}
public class ShowOrders
{
private readonly string email;
ShowOrders (string email)
{
this.email = email;
}
public void Show ()
{
using (Technic context = new Technic ())
{
var findedRecords = context.Customers.Where (r = & gt; r.Email == this.email) .ToList ();
if (findedRecords.Count () & gt; 0)
{
foreach (var item in findedRecords)
{
Console.WriteLine ($ "Id: {item.Id} Name: {item.Name} Age: {item.Age}");
}
}
}
}
}
Answer 1
Apparently you are creating a class from another assembly. By default (if no access modifier is specified) a class member will have the scope internal
.
Make it public
.
public class ShowOrders
{
private readonly string email;
public ShowOrders (string email)
{
this.email = email;
}
... ... ...