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

  • Home
  • SEARCH
  • 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 8150841
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T15:11:08+00:00 2026-06-06T15:11:08+00:00

I have been using C# with Unity3d for a few years now, but am

  • 0

I have been using C# with Unity3d for a few years now, but am just starting with .NET programming. I get the error:

Cannot implicitly convert type ‘System.Collections.Generic.IEnumerable<URL>‘ to ‘System.Collections.Generic.List<URL>‘. An explicit conversion exists (are you missing a cast?)

Here is my code:

namespace TestBrowserHistory
{
    public class Test1
    {
        public Test1()
        {

        }
          static void Main()
    {
        InternetExplorer myClass = new InternetExplorer();
        List<URL> calledList = myClass.GetHistory();
        Console.WriteLine("Hello!");
        Console.WriteLine(calledList[1]);
        Console.ReadLine();
    }
    }
}

public class InternetExplorer
{
    // List of URL objects
    public List<URL> URLs { get; set; }
    public IEnumerable<URL> GetHistory()
    {
        // Initiate main object
        UrlHistoryWrapperClass urlhistory = new UrlHistoryWrapperClass();

        // Enumerate URLs in History
        UrlHistoryWrapperClass.STATURLEnumerator enumerator =
                                           urlhistory.GetEnumerator();

        // Iterate through the enumeration
        while (enumerator.MoveNext())
        {
            // Obtain URL and Title
            string url = enumerator.Current.URL.Replace('\'', ' ');
            // In the title, eliminate single quotes to avoid confusion
            string title = string.IsNullOrEmpty(enumerator.Current.Title)
                      ? enumerator.Current.Title.Replace('\'', ' ') : "";

            // Create new entry
            URL U = new URL(url, title, "Internet Explorer");

            // Add entry to list
            URLs.Add(U);
        }

        // Optional
        enumerator.Reset();

        // Clear URL History
        urlhistory.ClearHistory();

        return URLs;
    }

}

Thanks for any help!

  • 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-06T15:11:10+00:00Added an answer on June 6, 2026 at 3:11 pm

    You get that error because myClass.GetHistory(); returns IEnumerable<URL>, which is not same as List<URL> at compile time, although it is actually List<URL> at runtime. Change method signature to return List<URL>, cause you already do that

    public List<URL> GetHistory()
    

    Other workarounds would be to cast method call result to List<URL>

    List<URL> calledList = (List<URL>)myClass.GetHistory();
    

    Or construct new list from result

    List<URL> calledList = new List<URL>(myClass.GetHistory());
    

    If you do not need List functionality, you could define calledList as IEnumerable

    var calledList = myClass.GetHistory();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been using asp.net programming just from few months and I have to
I have been using WPF for a few years now and don't have any
I have been using ASP.NET for years, but I can never remember when using
I have been using the CodeIgniter system for a while now - but it
I have been using json.NET successfully in projects for some time now without any
I have been using form inheritance for a while now but without doing much
I have been using the python logging module for quite some time now, but
I have been using Castle MonoRail for the last two years, but in a
I have been using the CSLA framework for couple of years now for windows
I have been using ajax loaded data for a while now, but I am

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.