Table of Contents

Class RequestToken

Namespace
Cuemon.Messaging
Assembly
Cuemon.Core.dll

Provides a default implementation of the IRequestToken interface.

public record RequestToken : IRequestToken, IEquatable<RequestToken>
Inheritance
RequestToken
Implements

Examples

The following example demonstrates how to use to uniquely identify an individual request within a system.

using System;
using Cuemon.Messaging;

namespace MyApp.Examples;

public class RequestTokenExample
{
    public void Demonstrate()
    {
        // Each request gets its own unique ID
        var request1 = new RequestToken();
        var request2 = new RequestToken();

        Console.WriteLine($"Request 1 ID: {request1}");
        Console.WriteLine($"Request 2 ID: {request2}");
        Console.WriteLine($"Are they different? {request1.RequestId != request2.RequestId}");

}
}

Constructors

RequestToken(string)

Initializes a new instance of the RequestToken class.

public RequestToken(string requestId = null)

Parameters

requestId string

The string that uniquely identifies a request. Default value is a GUID expressed as 32 digits.

Properties

RequestId

Gets the unique request identifier.

public string RequestId { get; }

Property Value

string

The unique request identifier.

Methods

ToString()

Returns a string that represents this instance.

public override string ToString()

Returns

string

A string that represents this instance.

See Also