✅ Accsessing Method in another class by object
I have a customer class which contains the method I want to access
I want to call that method in my program.cs inside my
It is supposed to search for customers with the written name
Thanks beforehand
public override void GetAllVichles(List<Enrollment> en)
{
//en.Sort();
foreach (var enrollment in en)
{
foreach (var item in enrollment.Enrollments)
{
if (item.CustomerInfo.FirstName == FirstName && item.CustomerInfo.LastName == LastName)
{
Console.WriteLine($"{item.CustomerInfo.FirstName} {item.VichleInfo.vichleList}");
};
}
}
} public override void GetAllVichles(List<Enrollment> en)
{
//en.Sort();
foreach (var enrollment in en)
{
foreach (var item in enrollment.Enrollments)
{
if (item.CustomerInfo.FirstName == FirstName && item.CustomerInfo.LastName == LastName)
{
Console.WriteLine($"{item.CustomerInfo.FirstName} {item.VichleInfo.vichleList}");
};
}
}
}I want to call that method in my program.cs inside my
foreachforeach Console.WriteLine("Write name of customer");
string customSearch = Console.ReadLine();
foreach (var item in vichle.vichleList)
{
if(customSearch == item.Owner.FirstName)
{
} Console.WriteLine("Write name of customer");
string customSearch = Console.ReadLine();
foreach (var item in vichle.vichleList)
{
if(customSearch == item.Owner.FirstName)
{
}It is supposed to search for customers with the written name
Thanks beforehand