GuidRawHex 1.0.1

dotnet add package GuidRawHex --version 1.0.1
                    
NuGet\Install-Package GuidRawHex -Version 1.0.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="GuidRawHex" Version="1.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="GuidRawHex" Version="1.0.1" />
                    
Directory.Packages.props
<PackageReference Include="GuidRawHex" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add GuidRawHex --version 1.0.1
                    
#r "nuget: GuidRawHex, 1.0.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package GuidRawHex@1.0.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=GuidRawHex&version=1.0.1
                    
Install as a Cake Addin
#tool nuget:?package=GuidRawHex&version=1.0.1
                    
Install as a Cake Tool

GuidRawHex

A lightweight .NET library for converting between Guid and RAW(16) byte/hex representations.

Features

  • Guid → byte[]
  • Guid → HEX string
  • byte[] → Guid
  • HEX string → Guid
  • Suitable for Oracle RAW(16) values
  • Simple and lightweight API

Installation

Install the NuGet package:


dotnet add package GuidRawHex

Or install it using Visual Studio's NuGet Package Manager.

Usage

using GuidRawHex;

Console.WriteLine("GuidRaw Test");

var id = Guid.NewGuid();

// Guid -> byte[]
byte[] raw = GuidRaw.ToRaw(id);

// Guid -> HEX string
string rawHex = GuidRaw.ToRawHex(id);

// byte[] -> Guid
Guid guid1 = GuidRaw.ToGuid(raw);

// HEX string -> Guid
Guid guid2 = GuidRaw.ToGuid(rawHex);

Console.WriteLine($"GUID          : {id}");
Console.WriteLine($"RAW as Byte[] : {raw}");
Console.WriteLine($"RAW HEX       : {rawHex}");
Console.WriteLine($"GUID 1        : {guid1}");
Console.WriteLine($"GUID 2        : {guid2}");

Example Output

GuidRaw Test GUID : c4e9b348-1b8e-4479-9d27-ec18bf1889b2 RAW as Byte[] : 48B3E9C48E1B79449D27EC18BF1889B2 RAW HEX : 48B3E9C48E1B79449D27EC18BF1889B2 GUID 1 : c4e9b348-1b8e-4479-9d27-ec18bf1889b2 GUID 2 : c4e9b348-1b8e-4479-9d27-ec18bf1889b2

API

GuidRaw.ToRaw(Guid)

Converts a Guid to a 16-byte byte[].

byte[] raw = GuidRaw.ToRaw(id);

This can be used when a binary RAW(16) value is required.

GuidRaw.ToRawHex(Guid)

Converts a Guid to a hexadecimal string representation.

string rawHex = GuidRaw.ToRawHex(id);

Useful for logging, debugging, displaying RAW values, or comparing values.

GuidRaw.ToGuid(byte[])

Converts a 16-byte RAW value to a Guid.

Guid id = GuidRaw.ToGuid(raw); GuidRaw.ToGuid(string)

Converts a hexadecimal RAW string to a Guid.

Guid id = GuidRaw.ToGuid(rawHex); Oracle RAW(16)

For Oracle RAW(16) columns, use ToRaw() when the application requires the binary representation:

byte[] raw = GuidRaw.ToRaw(id);

Use ToRawHex() when you need to display or log the RAW value:

string rawHex = GuidRaw.ToRawHex(id);

License

MIT License

Copyright (c) 2026 Mehmet ONAT

:::

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net8.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.1 95 9/13/2026