CKTIS / C#
System.Guid: referência prática
System.Guid: referência prática: Guid é um identificador de 128 bits com várias representações textuais definidas.
Versão: .NET API; verified on .NET 10.0.14
Sintaxe
System.Guid /* select a documented member or constructor */Guid é um identificador de 128 bits com várias representações textuais definidas.
Usa-o como identificador praticamente único quando não são necessários segredo nem ordem cronológica natural.
Um Guid não é segredo e a inserção aleatória pode fragmentar índices de bases de dados.
Parse lança FormatException para texto inválido, TryParse devolve false e Empty contém todos os bits a zero.
O programa completo usa realmente System.Guid; o stdout exato esperado é 00112233445566778899aabbccddeeff.
Exemplos
using System;
using System.Buffers;
using System.Collections.Concurrent;
using System.Collections.Frozen;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Text;
using System.Text.Json;
using System.Text.Json.Nodes;
using System.Text.Json.Serialization;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Channels;
using System.Threading.Tasks;
using Number = System.Int32;
var id = Guid.Parse("00112233-4455-6677-8899-aabbccddeeff");
Console.WriteLine(id.ToString("N"));
Resultado
00112233445566778899aabbccddeeff
O programa completo usa realmente `System.Guid`; o stdout exato esperado é `00112233445566778899aabbccddeeff`.