Тема: Помилка 1 "Clinic" є простір імен, але використовується як тип

using System;
using System.Windows.Forms;
using Clinic.Core;
using Clinic.Services;
using ClinicApp.Services;

namespace HospitalApp
{
    public partial class Form1 : Form
    {
        private ClinicAppService clinicservice;
        private ClinicPatientsService clinicpatientsservice;
        private ClinicDoctorsService ClinicDoctorsService;
        private DoctorMode doctorMode = DoctorMode.Create;

        public Form1()
        {
            InitializeComponent();
            clinicservice = new ClinicAppService();
            clinicpatientsservice = new ClinicPatientsService();
            ClinicDoctorsService = new ClinicDoctorsService();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            updateHospitalsList();
            updatePatienceList();
            updateDoctorList(); 
        }

        private void updateDoctorList()
        {
            listBoxDoctors.Items.Clear();
            listBoxDoctors.Items.AddRange(ClinicDoctorsService.GetList().ToArray());
        }

        private void updatePatienceList()
        {
            listBoxPatients.Items.Clear();
            listBoxPatients.Items.AddRange(clinicpatientsservice.GetList().ToArray());
        }
        private void updateHospitalsList()
        {
            listBoxHospitals.Items.Clear();
            listBoxHospitals.Items.AddRange(clinicservice.GetList().ToArray());
            comboBoxHospitals.Items.Clear(); 
            comboBoxHospitals.Items.AddRange(clinicservice.GetList().ToArray());
        }

        private void buttonSavePatients_Click(object sender, EventArgs e)
        {

        }

        private void buttonSaveDoctors_Click(object sender, EventArgs e)
        {

            if (doctorMode == DoctorMode.Create)
            {
                var newDoctor = new Doctors
                {
                    Id = Guid.NewGuid(),
                    DateOfBirth = dateTimePickerDoB.Value,
                    FirstName = textBoxFN.Text,
                    LastName = textBoxLN.Text,
                    Hospital = comboBoxHospital.SelectedItem as Clinic
                };
                ClinicDoctorsService.Create(newDoctor);
            }
            else if(doctorMode == DoctorMode.Edit)
            {
                var updDoctor = new Doctors
                {
                    Id = (listBoxDoctors.SelectedItem as Doctors).Id,
                    DateOfBirth = dateTimePickerDoB.Value,
                    FirstName = textBoxFN.Text,
                    LastName = textBoxLN.Text,
                    Hospital = comboBoxHospital.SelectedItem as Clinic
                };
                ClinicDoctorsService.Update(updDoctor);
            }
            updateDoctorList();
            buttonClearDoctors_Click(null, null);
        }

        private void ListBoxDoctors_SelectedIndexChanged(object sender, EventArgs e)
        {
            buttonRemoveDoctors.Enabled = listBoxDoctors.SelectedIndex != -1;

            if(listBoxDoctors.SelectedIndex != -1)
            {
                var doctor = listBoxDoctors.SelectedItem as Doctors;
                textBoxFN.Text = doctor.FirstName;
                textBoxLN.Text = doctor.LastName;
                dateTimePickerDoB.Value = doctor.DateOfBirth;
                comboBoxHospital.SelectedItem = doctor.Hospital;

                doctorMode = DoctorMode.Edit;
            }
        }

        private void buttonRemoveDoctors_Click(object sender, EventArgs e)
        {
            if(listBoxDoctors.SelectedIndex != -1)
            {
                var doctor = listBoxDoctors.SelectedItem as Doctors;
                var dialogResult = MessageBox.Show($"Ви справді бажаєте видалити клієнта:{doctor}", "Видалення", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);

                if(dialogResult == DialogResult.OK) 
                {
                    ClinicDoctorsService.Delete(doctor.Id);
                    updateDoctorList();
                    buttonRemoveDoctors.Enabled = listBoxDoctors.SelectedIndex != 1;
                }
            }
        }
        private void buttonClearDoctors_Click(object sender, EventArgs e)
        {
            textBoxFN.Clear();
            textBoxLN.Clear();
            dateTimePickerDoB.Value = DateTime.Now;
            comboBoxHospital.SelectedIndex = -1;
            doctorMode = DoctorMode.Create;
        }
    }
}

2

Re: Помилка 1 "Clinic" є простір імен, але використовується як тип

Оператор as