static byte[] SerializeServerGraphData(NavGraph graph) { var stream = new MemoryStream(); var writer = new BinaryWriter(stream); var ctx = new GraphSerializationContext(writer); graph.SerializeServerInfo(ctx); byte[] bytes = stream.ToArray(); writer.Close(); return(bytes); }