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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T01:50:27+00:00 2026-06-14T01:50:27+00:00

I am building my own sharding solution with ASP.NET C# and MySQL. For the

  • 0

I am building my own sharding solution with ASP.NET C# and MySQL. For the Id of each row I use the following:

  • Shard Id – Int (1-65535)
  • Table Type Id – Small Int (1-65535)
  • Incremental number (1 – 4294967295)

So for example, an ID should be in the url like this:

http://mywebsite.com/folders/65535655354294967297

What I want to know is how to combine the numbers into a big number so I can extract the data later on. So for example, I won’t use 1 as the shard ID, I would probably need to you 00001 because later it will be easier to extract that number by making a division on the whole number.

So how can I do that, what is the best way to build a long number with three seperate numerical values and then be able to extract them back in code?

I look for the most efficient way to do it in C#

Thanks.

  • 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-14T01:50:28+00:00Added an answer on June 14, 2026 at 1:50 am

    You can use hex represantations of numbers

    ushort ShardId=1;
    ushort TableTypeId = 100;
    uint IncrementalNumber = 1000;
    
    string url = ShardId.ToString("X4") + TableTypeId.ToString("X4")
                                        + IncrementalNumber.ToString("X8");
    
    var i1 = Convert.ToUInt16(url.Substring(0, 4), 16);
    var i2 = Convert.ToUInt16(url.Substring(4, 4), 16);
    var i3 = Convert.ToUInt32(url.Substring(8, 8), 16);
    

    OR

    string url = (((ulong)ShardId << 48) | ((ulong)TableTypeId << 32) | IncrementalNumber)
                 .ToString("X16");
    
    var u  = Convert.ToUInt64(url,16);
    var i1 = (ushort)(u >> 48);
    var i2 = (ushort)((u >> 32) & 0xffff);
    var i3 = (uint)(u & 0xffffffff);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am building my own sharding solution. Each ID is constructed as follows: shard
I am building my own GridView in an ASP.NET project I am drawing out
I'm building an Android app with OpenGL.I created 2 squares, each with their own
I'm following the NerdDinner tutorial while building my own application. The tutorial gives this:
I am currently building my own small scale Blog CMS with ASP MVC C#.
I'm building my own personal CMS right now with PHP and MySql and I'm
Im building my own forum where you can use diffrent types of BBcode and
I am interested in building my own php framework for my personal use to
I am building my own home page. I find someone's page good, and downloaded
I am building my own torrent site and after doing some research I have

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.