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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T21:13:40+00:00 2026-05-17T21:13:40+00:00

Good night, I have an SQLite query which I am executing in C# using

  • 0

Good night,

I have an SQLite query which I am executing in C# using the ExecuteScalar() command. The result in an Object type variable which is in fact a value of type Int64. As I need to cast it to an Int32, I tried first using Convert.ToInt32 and now I am using (Int32)(Int64)Object, although I get the same performance with both. The question is that this kind of cast seems to take an additional 6ms to perform, and the method concerned is critical code which should be executed as fast as possible… Is there any way to perform this cast faster, by using, for example, bit operators or some other method?

Just in case this is not possible, I really don’t understand why the result of the query is an Int64… is there any way I can force it to be an Int32?

Thank you very much.

  • 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-17T21:13:41+00:00Added an answer on May 17, 2026 at 9:13 pm

    You could use a data reader instead of execute scalar and call the static getint32 function. Not sure if it would be faster though.

    Alternatively, you can cast your result in the sql query before it is returned. Again, this may actually decrease the overall performance.

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

Sidebar

Related Questions

Good night, I have a method in which I need to select from an
Good night, Let's suppose I have a class which implements a NFA/DFA whose transitions
good night i have a doubt what reason this output doesn't work [{var1:abc},{var2:abcd},{var3:abcde}] but
Good night, I'm not an expert in MySQL, I have 3 tables, but I
Good night, in my application I access my database through Hibernate. I want to
Good morning, I have mysql queries where I would like to calculate percentage of
Good day, I have a class that implements the LoaderCallbacks, and hence have the
Good day I have a custom TextBox that has a IndicatorTextBox.ui.xml file as well
Good day, I have like 15 images I need to be buttons. I have
I just started playing with memcache(d) last night so I have a LOT to

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.