public static byte[] ToBytes(this ArticleDirectory subject) { subject.Verify(); var json = Json.Default.Serialize(subject); return(Encoding.UTF8.GetBytes(json)); }
public static void WriteToFile(this ArticleDirectory subject, string filePath) { filePath.VerifyNotEmpty(nameof(filePath)); subject.Verify(); var json = Json.Default.SerializeFormat(subject); File.WriteAllText(filePath, json); }