[Update] public bool ByLaplaceDirichletTest ( FeatureUpdateContext updateContext, [Replicatable][ParentModel] CoordinateSystem coord, int x, // X Dimension of Surface. int y, // Y Dimension of Surface. int r, // Sampling rate for surface. double p, // Period of X. string gx // Function to plot between 0 and 2. ) { // Build a cache keyed off the incoming data. string key = x.ToString() + y.ToString() + r.ToString() + p.ToString() + gx.GetHashCode().ToString(); string path = "C:\\temp\\"; string file = path + key + ".tmp"; DPoint3d[][] points = new DPoint3d[r+1][]; BinaryFormatter bformatter = new BinaryFormatter(); if (File.Exists(file)) //There is a cached copy of this configuration, use it. { // This is a hook into a real time modification of the object. // Right here we could hook in and perform tweaks on the object. Stream stream = File.Open(file, FileMode.Open); points = (DPoint3d[][])bformatter.Deserialize(stream); stream.Close(); } else { try // to delete any old files. { string[] files = Directory.GetFiles(path, "*.tmp"); if (files.Length > 0) { foreach (string f in files) { System.IO.File.Delete(f); } } } catch (DirectoryNotFoundException) // First time through path may not exist. { Directory.CreateDirectory(path); } // Write the points to the disk is a serialized stream. Stream stream = File.Open(file, FileMode.Create); points = GetPoints(x, y, r, p, gx); bformatter.Serialize(stream, points); stream.Close(); } // Return the points, no matter where we got them from. return base.ByPointsAsDPoint3d(coord, points, 0, 0); }