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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T06:22:43+00:00 2026-05-24T06:22:43+00:00

as string caused me a problem when dealing with object arrays. The values after

  • 0

as string caused me a problem when dealing with object arrays. The values after execution are shown in the comments. Should it work this way?

object[] array = new object[2]; 
array[0] = 0.33;
array[1] = "0.33";
string a = array[0] as string; // a == null !!!??????
string b = array[1] as string; // b == "0.33"
string a2 = array[0] == null ? "" : array[0].ToString(); // a2 == "0.33"
string a3 = Convert.ToString(array[0]); // a3 == "0.33"
  • 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-05-24T06:22:44+00:00Added an answer on May 24, 2026 at 6:22 am

    Yes, it should.

    as is a cast operator.
    It can only be used to cast an object to a type that it actually is (or a superclass thereof).

    x as Y returns null if x isn’t a Y.

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

Sidebar

Related Questions

I have a problem that I want to append a string into StringBuffer object
I'm facing this problem 08-23 14:54:25.370: ERROR/AndroidRuntime(16728): Caused by: android.database.sqlite.SQLiteException: near table: syntax error:
This causes a compile-time exception: public sealed class ValidatesAttribute<T> : Attribute { } [Validates<string>]
I have a problem with a random crash caused by CSceneNode* pRoot = nodes[0];
I need to check if an exception is caused by some database problem. I
I'm suddenly getting this warning NSScanner: nil string argument in the debug window. I
Is there a way to see what connection string was used to connect to
I have no idea even where to start on this problem. I'm trying to
I am now designing an SNMP library. The problem is caused by a special
My Android app is crashing with this error: E/AndroidRuntime( 315): Caused by: android.database.sqlite.SQLiteException: bind

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.