Destroy an object in C#

Do nothing. Your reference (obj) will go out of scope. Then the Garbage Collector will come along and destroy your object. If there are (unmanaged) resources that need to be destroyed immediately, then implement the IDisposable interface and call Dispose in the finalize block. Or better, use the using statement. EDIT As suggested in the … Read more

Page vs Window in WPF?

Pages are intended for use in Navigation applications (usually with Back and Forward buttons, e.g. Internet Explorer). Pages must be hosted in a NavigationWindow or a Frame Windows are just normal WPF application Windows, but can host Pages via a Frame container

Visual Studio keeps crashing

You can always try some standard Visual Studio troubleshooting steps: Clean the solution Delete / rename all files in your solution created by VS, i.e. all .ncb, .suo, .user files Launch Visual Studio with all add-ins disabled: devenv.exe /SafeMode Reset All Settings: Tools -> Import / Export Settings -> Reset All Settings Delete HKCU:\Software\Micosoft\VisualStudio\9.0 and then restart Visual Studio … Read more

WebException (Status: Protocol Error)

Your server is returning HTTP 1201 which is not a standard status code. WebClient will fail with an exception when facing a non-successful status code (or an unrecognized one, in your case). I encorauge you to use the new HttpClient class if you can: If you have to do it synchronously:

How can I get the active screen dimensions?

Screen.FromControl, Screen.FromPoint and Screen.FromRectangle should help you with this. For example in WinForms it would be: I don’t know of an equivalent call for WPF. Therefore, you need to do something like this extension method.