In your thoughts, is it better to return a new allotted memory stream from the function, or to pass it in the function? For example,
Zero Fu (memorystream m) {m.Write (somebuffer, 0, somebuffer.Length); }
or
zero streaming foo () {memorystream rate = new memorystream (); Retval.Write (somebuffer, 0, somebuffer.Length); Return return; }
Is there anything to ask if you should return a string by the method or Take a stringbilder and add it in. The answer depends on the case of use.
Is it possible that the caller wants to call your data with existing data, which contains some data? Do they want to call it multiple times using the same stream? If so, then moving version of MemoryStream will be more efficient, on the other hand, if they want data only once, it may be more suitable to return MemoryStream (or, more bus, as a byte array) as well .
Unfortunately, we can not really explain the details of what is happening. Of course, you can apply both as surcharge and call the other.
Comments
Post a Comment