Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8629573
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T08:50:42+00:00 2026-06-12T08:50:42+00:00

This is just a simple problem that I’m a little stumped on… As far

  • 0

This is just a simple problem that I’m a little stumped on…

As far as I can see I am not actually using a char anywhere as model.children is a IList<> and model.Name is a string however my foreach loop is giving the error that it can’t convert char to catalogue.department, if you need any more information plese feel free to ask.

        private void DisplayOnWebsiteChecked(Object sender, EventArgs e)
    {
        var departments = model.Name;
        var departmentChildren = model.Children;

        if (departmentChildren != null)
        {
            int zeroChildren = 0;

            if (departmentChildren.Count.Equals(zeroChildren));
            {
                foreach (Department Children in departments)
                {
                }
            }
        }
    }

EDIT: This issue has actually be fixed, I will post the fixed code down below as it turns out I actually messed up the code by putting the list in the wrong place.

    private void DisplayOnWebsiteChecked(Object sender, EventArgs e)
    {
        var departments = model.Name;
        var departmentChildren = model.Children;

        if (departmentChildren != null)
        {
            int zeroChildren = 0;

            if (departmentChildren.Count.Equals(zeroChildren));
            {
                foreach (Department Child in departmentChildren)
                {
                }
            }
        }
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T08:50:43+00:00Added an answer on June 12, 2026 at 8:50 am

    model.Name is a string

    You have assigned:

    var departments = model.Name;
    

    here department is of type string and string implements IEnumerable<char>, that is why when you enumerate over it using foreach, the item in the foreach loop is of type char.

    and you are using

    foreach (Department Children in departments)
        {
        }
    

    Here Children is of type char since department is a string, whereas you have specified it to be of type Department that is why you are getting this error.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

actually I'm have a very simple problem (that's for sure) I just can't find
Maybe this is a simple problem, but I am just not seeing it :)
I'm new to Latex so hopefully this is just a simple problem. I'm using
A simple problem that I just can't find the 'right' answer too. I have
I'm guessing this is a simple problem, but I'm just learning... I have this:
[see later answer for more] I think this is just a simple rails question,
So I'm stuck with a little problem that seems simple but is giving me
very simple problem, but i want to see how experts look at it. This
I have simple LINQ problem that I can't figure out. I have a table
I have this simple program using powershell. This is just a proof of concept,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.