It is because you have written some code after the return statement, which are not getting executed.
That's why the codes written after the return statement are unreachable.
And the
type
variable is not used, only assigned.
So, your code should look like below.
public string getInformation()
{
string type = "";
if (courseType == 'c')
{
type = "HNC";
}
return (id + " " + Convert.ToString(courseType) + " " + Convert.ToString(CourseCode));
}
Note
I just corrected the current code. If you face any other problems with your logic, then you have to solve that. Otherwise it should work.