ActivityTraceId 结构

定义

表示 TraceId,其格式基于 W3C 标准。Represents a TraceId whose format is based on a W3C standard.

public value class ActivityTraceId : IEquatable<System::Diagnostics::ActivityTraceId>
public struct ActivityTraceId : IEquatable<System.Diagnostics.ActivityTraceId>
type ActivityTraceId = struct
Public Structure ActivityTraceId
Implements IEquatable(Of ActivityTraceId)
继承
ActivityTraceId
实现

注解

ActivityTraceId 结构反映了 W3C 标准对整个跟踪的 ID 所需的格式。The ActivityTraceId structure reflects the format that the W3C standard requires for the ID of the entire trace. 它由16个字节组成,通常表示为32个十六进制字符。It consists of 16 bytes, typically represented as 32 hexadecimal characters. ActivityTraceIdTraceId 属性返回。An ActivityTraceId is returned by the TraceId property.

由于 ActivityTraceId 是包含16个字节的结构,因此可以通过引用轻松地传递它。Because an ActivityTraceId is a structure that contains 16 bytes, it can be passed easily by reference. ActivityTraceId 包含用于在其十六进制字符串表示形式之间进行转换的方法,尝试避免在必须更改格式之前更改格式,并在创建后缓存其字符串表示形式。ActivityTraceId contains methods for converting to and from its hexadecimal string representation, tries to avoid changing formats until it has to, and caches its string representation after it is created. 它主要用作交换类型。It is mostly useful as an exchange type.

方法

CopyTo(Span<Byte>)

将当前 ActivityTraceId 的 16 个字节复制到指定的范围。Copies the 16 bytes of the current ActivityTraceId to a specified span.

CreateFromBytes(ReadOnlySpan<Byte>)

从一个包含 16 个字节的只读范围创建一个新的 ActivityTraceId 值。Creates a new ActivityTraceId value from a read-only span of 16 bytes.

CreateFromString(ReadOnlySpan<Char>)

从一个包含 32 个十六进制字符的只读范围创建一个新的 ActivityTraceId 值。Creates a new ActivityTraceId value from a read-only span of 32 hexadecimal characters.

CreateFromUtf8String(ReadOnlySpan<Byte>)

从一个包含 UTF8 编码字节的只读范围创建一个新的 ActivityTraceId 值。Creates a new ActivityTraceId value from a read-only span of UTF8-encoded bytes.

CreateRandom()

基于一个随机数字(很可能是唯一的数字)创建一个新的 ActivitySpanIdCreates a new ActivitySpanId based on a random number (that is very likely to be unique).

Equals(ActivityTraceId)

确定当前实例与指定的 ActivityTraceId 是否相等。Determines whether the current instance and a specified ActivityTraceId are equal.

Equals(Object)

确定此实例是否与指定的对象(也必须是 ActivityTraceId 实例)具有相同的值。Determines whether this instance and a specified object, which must also be an ActivityTraceId instance, have the same value.

GetHashCode()

返回 TraceId 的哈希代码。Returns the hash code of the TraceId.

ToHexString()

返回表示此范围 ID 的 16 个字符的十六进制字符串。Returns a 16-character hexadecimal string that represents this span ID.

ToString()

返回表示此跟踪 ID 的 32 个字符的十六进制字符串。Returns a 32-character hexadecimal string that represents this trace ID.

运算符

Equality(ActivityTraceId, ActivityTraceId)

确定两个指定的 ActivityTraceId 实例是否具有相同的值。Determines whether two specified ActivityTraceId instances have the same value.

Inequality(ActivityTraceId, ActivityTraceId)

确定两个指定的 ActivityTraceId 实例是否具有相同的值。Determines whether two specified ActivityTraceId instances have the same value.

适用于