# StringCodec Methods

[Type overview](/orleans/docs/api/csharp/microsoft.orleans.serialization/orleans.serialization.codecs.stringcodec/)

## ReadRaw(Reader&lt;TInput&gt;, uint) {#readraw-1-ref-orleans-serialization-buffers-reader-tinput-uint-bae69607}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.serialization/orleans.serialization.codecs.stringcodec/methods/readraw-1-ref-orleans-serialization-buffers-reader-tinput-uint-bae69607/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Serialization/Codecs/StringCodec.cs#L48-L51)

```csharp
public static string ReadRaw<TInput>(ref Reader<TInput> reader, uint numBytes)
```

Reads the raw string content.

### Parameters

- `reader` (`Reader<TInput>`)
- `numBytes` (`uint`): Encoded string length in bytes.

## ReadValue(Reader&lt;TInput&gt;, Field) {#readvalue-1-ref-orleans-serialization-buffers-reader-tinput-orleans-serializatio-950b2c71}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.serialization/orleans.serialization.codecs.stringcodec/methods/readvalue-1-ref-orleans-serialization-buffers-reader-tinput-orleans-serializatio-950b2c71/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Serialization/Codecs/StringCodec.cs#L30-L38)

```csharp
public static string ReadValue<TInput>(ref Reader<TInput> reader, Field field)
```

Reads a value.

### Parameters

- `reader` (`Reader<TInput>`): The reader.
- `field` (`Field`): The field.

### Returns

The value.

## WriteField(Writer&lt;TBufferWriter&gt;, uint, string) {#writefield-1-ref-orleans-serialization-buffers-writer-tbufferwriter-uint-string-0d30f033}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.serialization/orleans.serialization.codecs.stringcodec/methods/writefield-1-ref-orleans-serialization-buffers-writer-tbufferwriter-uint-string-0d30f033/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Serialization/Codecs/StringCodec.cs#L85-L94)

```csharp
public static void WriteField<TBufferWriter>(ref Writer<TBufferWriter> writer, uint fieldIdDelta, string value)
```

Writes a field without type info (expected type is statically known).

### Parameters

- `writer` (`Writer<TBufferWriter>`): The writer.
- `fieldIdDelta` (`uint`): The field identifier delta.
- `value` (`string`): The value.

## WriteRaw(Writer&lt;TBufferWriter&gt;, string, int) {#writeraw-1-ref-orleans-serialization-buffers-writer-tbufferwriter-string-int-03a2bf34}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.serialization/orleans.serialization.codecs.stringcodec/methods/writeraw-1-ref-orleans-serialization-buffers-writer-tbufferwriter-string-int-03a2bf34/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Serialization/Codecs/StringCodec.cs#L104-L121)

```csharp
public static void WriteRaw<TBufferWriter>(ref Writer<TBufferWriter> writer, string value, int numBytes)
```

Writes the raw string content.

### Parameters

- `writer` (`Writer<TBufferWriter>`)
- `value` (`string`): String to be encoded.
- `numBytes` (`int`): Encoded string length in bytes.
