1 // Licensed to the .NET Foundation under one or more agreements. 2 // The .NET Foundation licenses this file to you under the MIT license. 3 // See the LICENSE file in the project root for more information. 4 5 using System.Text; 6 7 namespace System.Reflection.Metadata.Tests 8 { GetString(byte* bytes, int count)9 public unsafe delegate string GetString(byte* bytes, int count); 10 11 public sealed class TestMetadataStringDecoder : MetadataStringDecoder 12 { 13 private readonly GetString _getString; 14 TestMetadataStringDecoder(Encoding encoding, GetString getString)15 public TestMetadataStringDecoder(Encoding encoding, GetString getString) 16 : base(encoding) 17 { 18 _getString = getString; 19 } 20 GetString(byte* bytes, int byteCount)21 public override unsafe string GetString(byte* bytes, int byteCount) 22 { 23 return _getString(bytes, byteCount); 24 } 25 } 26 } 27