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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T11:06:09+00:00 2026-06-04T11:06:09+00:00

I have one question.. Which has more effective performance? Or which take less time

  • 0

I have one question..

Which has more effective performance? Or which take less time to execute and Why?

session["var"].ToString()

or

(string)session["var"]
  • 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-04T11:06:11+00:00Added an answer on June 4, 2026 at 11:06 am

    ToString() is a method and (string) is casting (Explicit). IMO casting is always fast

    A cast operation between reference types does not change the run-time
    type of the underlying object; it only changes the type of the value
    that is being used as a reference to that object.

    Source: Explicit Conversions

    .ToString() can be called from any object. This method is inherited from object class and can be overloaded

    .(string) is a cast, Its not a function call. It should be used when it is sure that the object is already in string, it will throw an exception when it can’t convert to string including null

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

Sidebar

Related Questions

The question has two parts, one of which I already have the answer for.
I am learning JPA and have one question: In which situations we need more
I have a question regarding php and opening files PHP has more than one
I want to implement this view But I have one question: The text which
I have a question regarding the some data which is being transfered from one
Basically, I have the same question as this one , which unfortunately never got
I have one question, I was trying to find more information on the internet
I have more of a conceptual question. Assume one program running two threads. Both
I have one question; In my ASP.NET MVC web application have to do certain
I have one question about searching and counting files in directories and subdirectories. I

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.