This might be the newbie question here but I’m trying to copy two Streams using utility method. In the example below there may be 1000+ instances of the Worker class. And in each worker class copies one stream into another stream using utility. The stream could be FileStream, MemoryStream or even NetwrokStream.
What would be the best option here, should i use Static Copy method or Instance Copy Method?
Public class Worker { Public void DoWork() { // Assume we have instance of source & target stream here // Should i use Static UtilityStatic.Copy(source,target); //or should i use Instance UtilityInstance u = new UtilityInstance(); u.Copy(source,target); } } public abstract class UtilityStatic { public static void Copy(Stream source, Stream target) { int bufferSize = 10240; source.CopyTo(target, bufferSize); } } public class UtilityInstance { public void Copy(Stream source, Stream target) { int bufferSize = 10240; source.CopyTo(target, bufferSize); } }