This question is locked. New answers and comments are not allowed.
I've just been looking at some code that I've inherited and had this ...
Now, OK, it's perfectly legal but I can't imagine it is the sort of thing a professional developer would do on purpose, so I wonder if this kind of hiding an object with a wider scope is something we should expect JC to at least warn us about when it does happen.
As I say, just a Friday afternoon thought.
--
Stuart
public partial class MyControl : System.Web.UI.UserControl |
{ |
RadAjaxManager localManager; |
protected void Page_Load(object sender, EventArgs e) |
{ |
localManager = RadAjaxManager.GetCurrent(Page); |
... |
} |
... |
void SomeMethod() |
{ |
... |
RadAjaxManager localManager; |
localManager = RadAjaxManager.GetCurrent(Page); |
localManager.ResponseScripts.Add(...); |
} |
} |
Now, OK, it's perfectly legal but I can't imagine it is the sort of thing a professional developer would do on purpose, so I wonder if this kind of hiding an object with a wider scope is something we should expect JC to at least warn us about when it does happen.
As I say, just a Friday afternoon thought.
--
Stuart