/// <summary> /// Writes a <see cref="SyntaxNode"/> to the stream. /// </summary> /// <param name="this">The binary writer with which to write the value.</param> /// <param name="value">The value to write to the stream.</param> /// <param name="version">The file version of the data being written.</param> public static void Write(this BinaryWriter @this, SyntaxNode value, Int32 version) { @this.Write(value != null); if (value != null) { SyntaxSerializer.ToStream(@this, value, version); } }
/// <summary> /// Reads a <see cref="SyntaxNode"/> from the stream. /// </summary> /// <param name="this">The binary reader with which to read the value.</param> /// <param name="version">The file version of the data being read.</param> /// <returns>The value that was read.</returns> public static SyntaxNode ReadSyntaxNode(this BinaryReader @this, Int32 version) { var exists = @this.ReadBoolean(); if (exists) { return(SyntaxSerializer.FromStream(@this, version)); } return(null); }