In C#, when you declare but don't use a built-in class or struct you get a "declared but never used" warning, even if the variable is assigned to, such as in this code:
string myStr;
myStr = "foo";
return;
However you don't get the same warning for a user-defined class or struct:
Bar myBar;
myBar = new Bar();
return;
Why is there no warning in the latter case? If there are side effects to the constructor, you can just say new Bar();
and the only way there would be side effects to the assignment is if the assignment operator is overloaded. However Visual Studio could check for this and issue the warning if the operator isn't overloaded, yet it doesn't. Is there a technical reason why it doesn't do this?