I want to use the .NET 4.0 interface IObserver for a library, which also support earlier versions of the framework. I already have a conditional compilation that lets me build for each version of the framework.
I IObserver & lt; T & gt; Do not want to use the version of the Rx extension
What I'm thinking is adding this block's code to my library and all of you have my question here:
1) I know this is a bad idea, but I really, "why?" > If! NetWat namespace system {public interface IObserver & lt; In T & gt; {Zero full (); Zero on error (exception error); Zero on-exp (t-value); }} #endif I want to use standard interface so that the .NET 4.0 users can integrate in a quiet way that I have not yet thought. So I just do not want to duplicate this concept and do not want to loosen the integration with the other and The threat that I see, 3.5 My library is used in .NET 4.0, type collision can occur. Ideally, though, someone using v4.0 will use the library's 4.0 build. Should I be aware of this view? 2) Alternatively , I have considered doing this in my code instead (I am tilting in that direction) and I would like to know the thoughts of people Why this is a bad idea: and later where I want to use it: Any ideas? IObservable & lt; T & gt; Usage
#if! NET40 Namespot Fu {Public Interface IObserverProxy & lt; In T & gt; {Zero full (); Zero on error (exception error); Zero on-exp (t-value); }} #endif
#if IET = System.IObserver & LT; Times> # ISEbseververBar = Foo.IObserverProxy & lt; Times> #endif
Do not work well with external aliasing in the form of C # extension methods, I advise you Let me not put the interface in the system namespace because it will break those people who use both Rx and their library, I will put in the interface Fu namespace. People who want to use your library and RX can always create an extension method like this:
Fixed system. IOS Servable & lt; T & gt; ToSystemObservable & lt; T & gt; (This Foo.IObservable & lt; T & gt; source) In addition, the observable interface has been moved to different DLL systems in RX. Observe Encourage the use of those people to reconsider it is not a version of DLL RX to RX Build, so it should not be versioning problems. In this way, anyone using your library can use any (recent) construction of RX that they want to query on your objective objects.
Comments
Post a Comment