A recent discussion here at work about Binary Compatability sparked my memory about being able to programatically depreciate a method in .Net however I can't seem to remember where I saw it. I know I saw it happen in a video possibly here or in a MSDN
Webcast but I'm not sure where. Anyone have any ideas on how to do this?
-
-
Blkbam wrote:being able to programatically depreciate a method in .Net
If you're searching, you might have better luck with "deprecate" (no "i")
-
I had it right in my seach just not in the post. But I did manage to find it:
[Obsolete("This method is no longer valid")] public void Stuff() { }
-
Now, see if you can figure out how to amortize it over the lifetime of the application....
-
ScanIAm wrote:Now, see if you can figure out how to amortize it over the lifetime of the application....
*snort*
But seriously, I wonder if having Obsolete() take a date as an optional second parameter would be a worthy feature (after the date the function would error)
-
I'm not sure that setting a date (in compiled "stone" in the binary) would necessarily be a good choice for most systems. Generally you'd want a more determinate environment where concrete actions like installing or uninstalling determines programmatic behaviour.
To this extent ObsoleteAttribute is a 'softer' compile-time error construct, with no direct runtime ramifications. (Though of course these are normal reflectable attributes) Instead assembly versioning effectively manages your code's 'lifetime'. When the method signature no longer exists you get your error. No ticking timebombs of badly chosen dates being embedded in a sealed library that you don't own.
Thread Closed
This thread is kinda stale and has been closed but if you'd like to continue the conversation, please create a new thread in our Forums,
or Contact Us and let us know.