Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/stefh/longguid
A LongGuid solution with 512 bits per identifier as opposed to the default 128 bits.
https://github.com/stefh/longguid
Last synced: 18 days ago
JSON representation
A LongGuid solution with 512 bits per identifier as opposed to the default 128 bits.
- Host: GitHub
- URL: https://github.com/stefh/longguid
- Owner: StefH
- License: mit
- Created: 2018-02-25T10:22:19.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-02-26T18:33:40.000Z (over 6 years ago)
- Last Synced: 2024-05-19T14:28:49.827Z (6 months ago)
- Language: C#
- Size: 17.6 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# LongGuid
A LongGuid solution with 512 bits per identifier as opposed to the default 128 bits.## NuGet
[![NuGet Badge](https://buildstats.info/nuget/LongGuid)](https://www.nuget.org/packages/LongGuid)## Code Example
Usage is the same as a normal `Guid`.
``` csharp
// create new LongGuid
var longGuid = LongGuid.NewLongGuid();// Create from 4 normal Guids
var guid1 = Guid.Parse("10000000-0000-0000-0000-000000000001");
var guid2 = Guid.Parse("20000000-0000-0000-0000-000000000002");
var guid3 = Guid.Parse("30000000-0000-0000-0000-000000000003");
var guid4 = Guid.Parse("40000000-0000-0000-0000-000000000004");var longGuid = new LongGuid(guid1, guid2, guid3, guid4);
// convert to byte[]
byte[] bytes = longGuid.ToByteArray();// new from byte[]
byte[] bytes = ...
var longGuid = new LongGuid(bytes);// new from string
string str = "10000000-0000-0000-0000-000000000001-20000000-0000-0000-0000-000000000002-30000000-0000-0000-0000-000000000003-40000000-0000-0000-0000-000000000004";
var longGuid = new LongGuid(str);// parse from string
var longGuid = LongGuid.Parse("...")
```