Monthly Archives: November 2007

Create a Singleton in C#

Sometimes you need an object instance rather than a static class but you really want that object instance to be globally unique to your application, e.g. there can be only one.  Enter the singleton pattern:   public class MySingleton { … Continue reading

Posted in C# | Leave a comment

Determine Approximate Memory Used by an Object

Curious as to how much memory your object or list of objects is taking up?  Here’s a quick way to get an approximation:   long startMem = GC.GetTotalMemory(true);   SortedDictionary<string, MyClass> myDictionary = GenerateDictionary();   long endMem = GC.GetTotalMemory(true); long … Continue reading

Posted in C# | Leave a comment

Embed Resources into your .Net Projects

Worrying about file paths, locations, availability, and security of your project’s resource can be a real pain.  Fortunately, you can easily embed resources into your project’s DLL and reference them with ease from your code.  Here’s an example of how … Continue reading

Posted in C#, Visual Studio | Leave a comment

November 2007 Issue of TechNet Magazine: IT Toolbox

The November 2007 issue of TechNet Magazine is out on the website. Check out my IT Toolbox column here: http://technet.microsoft.com/magazine/bbf6a03e-f62d-4ff6-8c81-da5fc80cb402 In this issue I covered: My Screen Recorder Pro Video Screen Capture PerfectDisk 8 Disk Defrag Network Warrior (Book Review) WhoLockMe Manage File Locks … Continue reading

Posted in Microsoft TechNet | Leave a comment