Click here to Skip to main content
15,887,746 members
Articles / Desktop Programming / Windows Forms

Storm - the world's best IDE framework for .NET

Rate me:
Please Sign up or sign in to vote.
4.96/5 (82 votes)
4 Feb 2010LGPL311 min read 275.1K   6.5K   340  
Create fast, flexible, and extensible IDE applications easily with Storm - it takes nearly no code at all!
using System.Collections;

using Storm.TextEditor.Drawing.GDI;

namespace Storm.TextEditor.Core
{
	public class MemoryHandler
	{
		#region Fields

		private static ArrayList heap = new ArrayList();

		#endregion

		#region Properties

		public static GDIObject[] Items
		{
			get
			{
				ArrayList al = new ArrayList();

				foreach (GDIObject go in heap)
				{
					if (go != null)
						al.Add(go);
				}

				GDIObject[] gos = new GDIObject[al.Count];
				al.CopyTo(0, gos, 0, al.Count);

				return gos;
			}
		}

		#endregion

		#region Methods

		#region Public

		public static void Add(GDIObject item)
		{
			heap.Add(item);
		}

		public static void Remove(GDIObject item)
		{
			if (heap.Contains(item))
				heap.Remove(item);
		}

		public static void DestroyAll()
		{
			foreach (GDIObject go in Items)
				go.Dispose();
		}

		#endregion

		#endregion
	}
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The GNU Lesser General Public License (LGPLv3)



Comments and Discussions