.NET streams, passing streams between objects, best practices (C#) -


I'm currently writing a small toy codel in C # (going along the way. .)

The coder takes an input file path and removes the junk (comments etc) lines.

Then the file is passed for parsing, then finally another module that creates binary code.

This is not very complicated, but I do not want to write a temporary file in the file system at the end of an object all the time, which is the processing of the input file

I just stream I want to pass on the next object. I basically thought that each class involved in removing parsing / junk would be idisposable, but I think that means I can not stream on the next object for processing (the stream will stop, unless I Do not use it one in all.)

I think I am missing something here, is there an easy way to clear the streams between objects, or do I need a different approach?

In general, the responsibility of the consumer is to properly handle disposable objects. help!! Like

So in a clear scenario, either your reference to a disposable object, in this case, you should ensure that it is properly disposed; Or you pass the reference to someone else and forget about it.

Then about the cases where you need to reference context, but still have to pass it? In these cases, pass a copy of the disposable resource - it will tell you and the consumer to manage each other's life independently of two instances. However, if you come into this situation, then you should reconsider your design, as I say a code odor.


Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -