|
using GalleryServerPro.Business.Interfaces;
using System;
namespace GalleryServerPro.Business
{
/// <summary>
/// Represents a collection of <see cref="int">integers</see>. This is used in various places in Gallery Server Pro
/// instead of List<<see cref="int" />> per Microsoft best practices. Read about rule CA1002 for more information.
/// </summary>
public class IntegerCollection : System.Collections.ObjectModel.Collection<int>, IIntegerCollection
{
/// <summary>
/// Initializes a new instance of the <see cref="IntegerCollection"/> class.
/// </summary>
public IntegerCollection() : base(new System.Collections.Generic.List<int>()) { }
/// <summary>
/// This event fires after items have been removed from the collection through the Clear() method.
/// </summary>
public event EventHandler Cleared;
/// <summary>
/// Add the list of integers to the collection.
/// </summary>
/// <param name="values">A list of integers to add to the collection.</param>
public void AddRange(IIntegerCollection values)
{
foreach (int value in values)
{
Items.Add(value);
}
}
/// <summary>
/// Removes all elements from the <see cref="T:System.Collections.ObjectModel.Collection`1"/>.
/// </summary>
public new void Clear()
{
base.Clear();
if (Cleared != null)
{
Cleared(this, new EventArgs());
}
}
}
}
|
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.
I have nearly 20 years of industry experience in software development, architecture, and Microsoft Office products. My company
Tech Info Systems provides custom software development services for corporations, governments, and other organizations. Tech Info Systems is a registered member of the Microsoft Partner Program and I am a Microsoft Certified Professional Developer (MCPD).
I am the creator and lead developer of
Gallery Server Pro, a free, open source ASP.NET gallery for sharing photos, video, audio, documents, and other files over the web. It has been developed over several years and has involved thousands of hours. The end result is a robust, configurable, and professional grade gallery that can be integrated into your web site, whether you are a large corporation, small business, professional photographer, or a local church.