|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Com.WickedByte.Collections.Generic
{
/// <summary>
/// A generic read-only collection.
/// </summary>
/// <typeparam name="T"></typeparam>
internal class ReadOnlyCollection<T> : ICollection<T>
{
#region Private
private readonly ICollection<T> collection;
#endregion
#region ICollection<T> Members
public void Add( T item )
{
throw new ReadOnlyException();
}
public void Clear()
{
throw new ReadOnlyException();
}
public bool Contains( T item )
{
return collection.Contains( item );
}
public void CopyTo( T[] array, int arrayIndex )
{
collection.CopyTo( array, arrayIndex );
}
public int Count
{
get { return collection.Count; }
}
public bool IsReadOnly
{
get { return collection.IsReadOnly; }
}
public bool Remove( T item )
{
throw new ReadOnlyException();
}
#endregion
#region IEnumerable<T> Members
public IEnumerator<T> GetEnumerator()
{
return collection.GetEnumerator();
}
#endregion
#region IEnumerable Members
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
{
return collection.GetEnumerator();
}
#endregion
public ReadOnlyCollection( ICollection<T> collection )
{
this.collection = collection;
}
}
}
|
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.
Marshall's torrid relationship with programming started as a child using BASIC on a Commodore PET computer in the 70's. He continued programming through high school, but did not study Computer Science in college. At the time, compilers would fail without telling you why, so after much soul searching, he realized he didn't want to make a living by spending eight hours a day looking for a missing semi-colon.
By the time he was pursuing his Ph.D. in Communication and Marketing, Microsoft had released Visual Studio. The improvements in the IDE were enough to cause Marshall to have late night affairs with COM and ASP. Marshall spent the dotcom bubble years as a web developer. After the bubble burst, he worked independently as a Java developer for medical applications. When Microsoft released an early beta of the .NET Framework, he was convinced to switch his focus from the Java Platform to the new Framework. He spent some time at Philips Medical Systems writing the data-access layer for the Carevue Chart hospital system. He is currently Technical Director for ASE Technologies.
Marshall lives in Salem, Massachusetts but would rather be in Hawaii.