# PCWSTR

```csharp
[DebuggerDisplay("{" + nameof(DebuggerDisplay) + "}")]
public readonly unsafe struct PCWSTR : IEquatable<PCWSTR>
{
    public readonly char* Value;

    public PCWSTR(char* value) => Value = value;

    public static explicit operator char*(PCWSTR value) => value.Value;

    public static implicit operator PCWSTR(char* value) => new(value);

    public bool Equals(PCWSTR other) => Value == other.Value;

    public override bool Equals(object obj) => obj is PCWSTR other && Equals(other);

    public override int GetHashCode() => (int)Value;

    public int Length
    {
        get
        {
            var p = Value;
        
            if (p is null)
                return 0;
        
            while (*p != '\0')
                p++;
        
            return checked((int)(p - Value));
        }
    }

    public override string ToString() => Value is null ? string.Empty : new string(Value);

    public ReadOnlySpan<char> AsSpan() => Value is null ? default : new ReadOnlySpan<char>(Value, Length);

    private string DebuggerDisplay => ToString();
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://www.pinvoke.dev/foundation/pcwstr.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
