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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T00:40:48+00:00 2026-06-02T00:40:48+00:00

I have a field that is of type ‘object’. When I inspect it within

  • 0

I have a field that is of type ‘object’. When I inspect it within the Watch window of visual studio I see its Object[] and when I drill into the elements I see each element is a string.

But when I try to cast this to a String[] I get this error:

Cannot cast ‘MyObject’ (which has an actual type of ‘object[]’) to ‘string[]’ string[]

Any reason why I can’t do this cast? What is the best way to convert this object to a string array?

  • 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-02T00:40:50+00:00Added an answer on June 2, 2026 at 12:40 am
    string[] newarr =  Array.ConvertAll(objects, s => (string)s);
    

    –EDIT–

    since you’ve said I have an object (knowing that it is an object[] actually)

    string[] newarr =  Array.ConvertAll((object[])objects, s => (string)s);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Lucene index that contains documents that have a type field, this
I have a form and one of the fields is a check-all-that-applies type field
I have 3 similar tables, that would all have the same enum type field.
I have a field that may be blank, so I need to use Object.try,
I have an input field that is by default set to type=text so that
in the sql server database I have a field that is type numeric. Precision
I have a field in my model that's of type DecimalField . Even though
I have a text field that I want to save periodically as users type
Let's say we have a field that can be in more than one type,
I have a field that is type text and I want to convert it

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.