docs.unity3d.com
    Show / Hide Table of Contents

    Struct SerializedStringView

    A view on top of the PackedBinaryStream that represents a string.

    Inherited Members
    ValueType.Equals(Object)
    ValueType.GetHashCode()
    Object.Equals(Object, Object)
    Object.ReferenceEquals(Object, Object)
    Object.GetType()
    Namespace: Unity.Serialization.Json
    Syntax
    public readonly struct SerializedStringView : ISerializedView, IEquatable<string>

    Properties

    Item[Int32]

    Gets the Char at a specified position in the current SerializedStringView.

    Declaration
    public readonly char this[int index] { get; }
    Parameters
    Type Name Description
    Int32 index

    A position in the current string.

    Property Value
    Type Description
    Char
    Exceptions
    Type Condition
    IndexOutOfRangeException

    is greater than or equal to the length of this object or less than zero.

    Methods

    AsFixedString<T>()

    Allocates and returns a new FixedString instance based on the view.

    Declaration
    public readonly T AsFixedString<T>()
        where T : struct, INativeList<byte>, IUTF8Bytes
    Returns
    Type Description
    T

    A new FixedString instance.

    Type Parameters
    Name Description
    T

    The fixed string type.

    AsNativeText(Allocator)

    Allocates and returns a new NativeText instance based on the view.

    Declaration
    public readonly NativeText AsNativeText(Allocator allocator)
    Parameters
    Type Name Description
    Allocator allocator

    The allocator to use for the text.

    Returns
    Type Description
    NativeText

    A new NativeText instance.

    AsUnsafeText(Allocator)

    Allocates and returns a new UnsafeText instance based on the view.

    Declaration
    public readonly UnsafeText AsUnsafeText(Allocator allocator)
    Parameters
    Type Name Description
    Allocator allocator

    The allocator to use for the text.

    Returns
    Type Description
    UnsafeText

    A new UnsafeText instance.

    Equals(String)

    Determines whether this view and another specified String object have the same value.

    Declaration
    public readonly bool Equals(string other)
    Parameters
    Type Name Description
    String other

    The string to compare to this view.

    Returns
    Type Description
    Boolean

    true if the value of the value parameter is the same as the value of this view; otherwise, false.

    Implements
    IEquatable<T>.Equals(T)

    Equals<T>(T)

    Determines whether this view and another specified String object have the same value.

    Declaration
    public readonly bool Equals<T>(T other)
        where T : struct, INativeList<byte>, IUTF8Bytes
    Parameters
    Type Name Description
    T other

    The string to compare to this view.

    Returns
    Type Description
    Boolean

    true if the value of the value parameter is the same as the value of this view; otherwise, false.

    Type Parameters
    Name Description
    T

    The fixed string type.

    Length()

    Gets the number of characters in the SerializedStringView.

    Declaration
    public readonly int Length()
    Returns
    Type Description
    Int32

    The number of characters in the string.

    ToString()

    Allocates and returns a new string instance based on the view.

    Declaration
    public override readonly string ToString()
    Returns
    Type Description
    String

    A new String instance.

    Overrides
    ValueType.ToString()
    Back to top
    Terms of use
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023