using System.Runtime.InteropServices; namespace Vanara.InteropServices { /// Marshals strings that are allocated by native code and must be freed using CoTaskMemFree after use. /// public class CoTaskMemStringMarshaler : GenericStringMarshalerBase { private CoTaskMemStringMarshaler(CharSet charSet) : base(charSet) { } /// Gets the instance. /// The cookie. /// A new instance of this class. public static ICustomMarshaler GetInstance(string cookie) => new CoTaskMemStringMarshaler(CharSetFromString(cookie, CharSet.Unicode)); } }