forked from ServiceStack/ServiceStack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStringEx.cs
More file actions
26 lines (23 loc) · 866 Bytes
/
StringEx.cs
File metadata and controls
26 lines (23 loc) · 866 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// -----------------------------------------------------------------------
// <copyright file="StringEx.cs" company="Asynkron HB">
// Copyright (C) 2015-2017 Asynkron HB All rights reserved
// </copyright>
// -----------------------------------------------------------------------
using System.Runtime.CompilerServices;
using Wire.Internal;
namespace Wire.Extensions
{
internal static class StringEx
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static byte[] ToUtf8Bytes(this string str)
{
return NoAllocBitConverter.Utf8.GetBytes(str);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static string FromUtf8Bytes(byte[] bytes, int offset, int count)
{
return NoAllocBitConverter.Utf8.GetString(bytes, offset, count);
}
}
}