Windows/C# system-level sequential number generato

2019-07-14 14:21发布

Is there a managed system-level sequential number generator? DateTime.Now.Ticks won't do because the operations I'm doing sometimes occur more than once per tick.


Requirement Clarifications:

  • Process agnostic - there's really only one process that would be accessing this.
  • Performance is critical! This is used for logging impressions on an adserver, which can reach 1k/sec

It would need to be one of the following:

  • A 4-byte sequential number that resets every tick
  • A 12-byte sequential number - essentially adding 4 bytes of granularity to a DateTime

7条回答
爷的心禁止访问
2楼-- · 2019-07-14 15:14

I think the closest thing is a guid, which as I'm sure you're aware is at best only partially sequential.

查看更多
登录 后发表回答