Modifica

Condividi tramite


StringPool.GetOrAdd Method

Definition

Overloads

GetOrAdd(ReadOnlySpan<Char>)

Gets a cached String instance matching the input content, or creates a new one.

GetOrAdd(String)

Gets a cached String instance matching the input content, or stores the input one.

GetOrAdd(ReadOnlySpan<Byte>, Encoding)

Gets a cached String instance matching the input content (converted to Unicode), or creates a new one.

GetOrAdd(ReadOnlySpan<Char>)

Gets a cached String instance matching the input content, or creates a new one.

public string GetOrAdd (ReadOnlySpan<char> span);
member this.GetOrAdd : ReadOnlySpan<char> -> string
Public Function GetOrAdd (span As ReadOnlySpan(Of Char)) As String

Parameters

span
ReadOnlySpan<Char>

The input ReadOnlySpan<T> with the contents to use.

Returns

A String instance with the contents of span, cached if possible.

Applies to

GetOrAdd(String)

Gets a cached String instance matching the input content, or stores the input one.

public string GetOrAdd (string value);
member this.GetOrAdd : string -> string
Public Function GetOrAdd (value As String) As String

Parameters

value
String

The input String instance with the contents to use.

Returns

A String instance with the contents of value, cached if possible.

Applies to

GetOrAdd(ReadOnlySpan<Byte>, Encoding)

Gets a cached String instance matching the input content (converted to Unicode), or creates a new one.

public string GetOrAdd (ReadOnlySpan<byte> span, System.Text.Encoding encoding);
member this.GetOrAdd : ReadOnlySpan<byte> * System.Text.Encoding -> string
Public Function GetOrAdd (span As ReadOnlySpan(Of Byte), encoding As Encoding) As String

Parameters

span
ReadOnlySpan<Byte>

The input ReadOnlySpan<T> with the contents to use, in a specified encoding.

encoding
Encoding

The Encoding instance to use to decode the contents of span.

Returns

A String instance with the contents of span, cached if possible.

Applies to