How to hide the red lines?

  • Thread starter Thread starter BenTam
  • Start date Start date
B

BenTam

Guest
Dear All,

I copy the following code from the book "Introduction to CSharp 8". However the employee () is red lined. What is the type of "Employee ()", an array, collection, a class, or a method?

1618176.gif

The source code is as follows.


var bassam = new Employee () { Age = 42 , Name = "Bassam" };

var thomas = new Employee () { Age = 43 , Name = "Thomas" };

var obj = new object ();

Console.Console.WriteLine ( GetEmployee ( bassam ));

Console.WriteLine ( GetEmployee ( thomas ));

Console.WriteLine ( GetEmployee ( obj ));

static string GetEmployee ( object o ) => o switch

{Employee p when p.Age == 42 && p.Name== "Bassam" => $ "{p.Name} Alugili",

Employee p => $ "{p.Name} Albrecht",

_ => "unknown"};

Continue reading...
 
Back
Top