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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T18:47:20+00:00 2026-06-15T18:47:20+00:00

The short version – Is there an easy way to take a variable of

  • 0

The short version –

Is there an easy way to take a variable of type object containing an instance of an unknown array (UInt16[], string[], etc.) and treat it as an array, say call String.Join(“,”, obj) to produce a comma delimited string?

Trivial? I thought so too.

Consider the following:

object obj = properties.Current.Value;

obj might contain different instances – an array for example, say UInt16[], string[], etc.

I want to treat obj as the type that it is, namely – perform a cast to an unknown type. After I accomplish that, I will be able to continue normally, namely:

Type objType = obj.GetType();
string output = String.Join(",", (objType)obj);

The above code, of course, does not work (objType unknown).

Neither does this:

object[] objArr = (object[])obj;   (Unable to cast exception)

Just to be clear – I am not trying to convert the object to an array (it’s already an instance of an array), just be able to treat it as one.

Thank you.

  • 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-15T18:47:21+00:00Added an answer on June 15, 2026 at 6:47 pm

    Assuming you’re using .NET 4 (where string.Join gained more overloads) or later there are two simple options:

    • Use dynamic typing to get the compiler to work out the generic type argument:

      dynamic obj = properties.Current.Value;
      string output = string.Join(",", obj);
      
    • Cast to IEnumerable, then use Cast<object> to get an IEnumerable<object>:

      IEnumerable obj = (IEnumerable) properties.Current.Value;
      string output = string.Join(",", obj.Cast<object>());
      
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Short version: Is it easy/feasible/possible to program modal window in Flash (AS3)? Is there
Short version: Is there a simple, built-in way to identify the calling view in
Short version: Is there a simple way to get the value of a primary
Short Version Is there a way to force (or provide a hint to) Microsoft
Short version: Is there way to achieve in Python the same effect achieved by
Short Version Is there a way to have visually represented user re-sizable data ranges
Short version: When two lists are adjacent to each other, is there a way
Short version: Is there an attractive, simple way of implementing a language-specific url structure,
Short version Is there a way to prevent R from ever using any virtual
Short Version: In Python is there a way to (cleanly/elegantly) say Give me these

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.