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 8142695
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T12:53:53+00:00 2026-06-06T12:53:53+00:00

I am getting the error: ‘string[]’ does not contain a definition for ‘Cast’ and

  • 0

I am getting the error:

‘string[]’ does not contain a definition for ‘Cast’ and no extension method ‘Cast’ accepting a first argument of type ‘string[]’ could be found (are you missing a using directive or an assembly reference?)

on the following piece of code:

return mNames.Cast().ToArray();

What using directive or assembly reference do I need?
How do I find out such things?

I’m a noob at C# and .NET, I’m just copying code to get a job done, so don’t get too technical with me.

  • 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-06T12:53:54+00:00Added an answer on June 6, 2026 at 12:53 pm

    (1) Make sure you are working on C# 3.0+

    (2) Make sure your code contains:

    using System.Linq;
    

    (3) .Cast is a generic method, you need to specify the type parameter, like this:

    return mNames.Cast<AnotherType>().ToArray();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm getting error from devise User does not respond to 'devise' method when running
Getting error inside MVC3 web application. LINQ to Entities does not recognize the method
getting error: ActiveRecord::StatementInvalid (PGError: ERROR: argument of HAVING must be type boolean, not type
Getting error at line [theSelectedRoutine addExerciseObject: exercise]; saying method -addExerciseObject not found. Interface: @property
i am getting error : Error 1 The type or namespace name'CreateUser' does not
I am getting error schema does not yet agree while creating new key-space on
Update getting error when i try to call the method from Activity: SQLiteDatabase db
I ma getting error like Cannot implicitly convert type 'string' to 'System.Web.UI.WebControls.Unit' in the
I'm getting error C3095: 'Xunit::Extensions::InlineDataAttribute': attribute cannot be repeated in C++/CLI code but not
Getting error with Could not find endpoint element with name 'CaseJacketPort' and contract 'GrandJuryService.CaseJacket'

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.