protected static string WriteStringAsText(string value, DxfAcadVersion version) { using (var ms = new MemoryStream()) { var writer = new DxfWriter(ms, asText: true, version: version); writer.CreateInternalWriters(); writer.WriteStringWithEncoding(value); writer.Flush(); ms.Seek(0, SeekOrigin.Begin); using (var reader = new StreamReader(ms)) { return(reader.ReadToEnd()); } } }