Implement custom stream

后端 未结 2 1152
一个人的身影
一个人的身影 2021-01-04 10:08

I am calling a dll that writes to a stream. The signature of the method in the dll looks like:

public bool SomeMethod(Stream stream);

and t

2条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-04 10:20

    If all you want to do is fire an event when Read, Seek or similar methods are called, override the base class versions, call them directly and raise the appropriate event before or after. If you want help on writing stream classes, have a look at the .Net code itself available at http://referencesource.microsoft.com/netframework.aspx. However, if you want to parse the stream in to something more readable, consider creating an IEnumerable that reads in and processes the stream, instead.

提交回复
热议问题