All unit test classes are now internal; updated copyright statement for the year 2012; added hulls for the upcoming ObservableSet<> and ReadOnlySet<> classes; switched generic parameter naming convention TSomething instead of SomethingType
git-svn-id: file:///srv/devel/repo-conversion/nusu@252 d2e56fa2-650e-0410-a79f-9358c0239efd
This commit is contained in:
parent
61c858cb1c
commit
75552b5150
126 changed files with 922 additions and 463 deletions
|
|
@ -1,7 +1,7 @@
|
|||
#region CPL License
|
||||
/*
|
||||
Nuclex Framework
|
||||
Copyright (C) 2002-2010 Nuclex Development Labs
|
||||
Copyright (C) 2002-2012 Nuclex Development Labs
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the IBM Common Public License as
|
||||
|
|
@ -25,14 +25,14 @@ using System.Collections.Generic;
|
|||
namespace Nuclex.Support.Collections {
|
||||
|
||||
/// <summary>Wraps a Collection and prevents users from modifying it</summary>
|
||||
/// <typeparam name="ItemType">Type of items to manage in the Collection</typeparam>
|
||||
public class ReadOnlyCollection<ItemType> :
|
||||
ICollection<ItemType>,
|
||||
/// <typeparam name="TItem">Type of items to manage in the Collection</typeparam>
|
||||
public class ReadOnlyCollection<TItem> :
|
||||
ICollection<TItem>,
|
||||
ICollection {
|
||||
|
||||
/// <summary>Initializes a new read-only Collection wrapper</summary>
|
||||
/// <param name="collection">Collection that will be wrapped</param>
|
||||
public ReadOnlyCollection(ICollection<ItemType> collection) {
|
||||
public ReadOnlyCollection(ICollection<TItem> collection) {
|
||||
this.typedCollection = collection;
|
||||
this.objectCollection = (collection as ICollection);
|
||||
}
|
||||
|
|
@ -40,7 +40,7 @@ namespace Nuclex.Support.Collections {
|
|||
/// <summary>Determines whether the List contains the specified item</summary>
|
||||
/// <param name="item">Item that will be checked for</param>
|
||||
/// <returns>True if the specified item is contained in the List</returns>
|
||||
public bool Contains(ItemType item) {
|
||||
public bool Contains(TItem item) {
|
||||
return this.typedCollection.Contains(item);
|
||||
}
|
||||
|
||||
|
|
@ -49,7 +49,7 @@ namespace Nuclex.Support.Collections {
|
|||
/// <param name="arrayIndex">
|
||||
/// Starting index at which to begin filling the destination array
|
||||
/// </param>
|
||||
public void CopyTo(ItemType[] array, int arrayIndex) {
|
||||
public void CopyTo(TItem[] array, int arrayIndex) {
|
||||
this.typedCollection.CopyTo(array, arrayIndex);
|
||||
}
|
||||
|
||||
|
|
@ -65,7 +65,7 @@ namespace Nuclex.Support.Collections {
|
|||
|
||||
/// <summary>Returns a new enumerator over the contents of the List</summary>
|
||||
/// <returns>The new List contents enumerator</returns>
|
||||
public IEnumerator<ItemType> GetEnumerator() {
|
||||
public IEnumerator<TItem> GetEnumerator() {
|
||||
return this.typedCollection.GetEnumerator();
|
||||
}
|
||||
|
||||
|
|
@ -73,14 +73,14 @@ namespace Nuclex.Support.Collections {
|
|||
|
||||
/// <summary>Adds an item to the end of the List</summary>
|
||||
/// <param name="item">Item that will be added to the List</param>
|
||||
void ICollection<ItemType>.Add(ItemType item) {
|
||||
void ICollection<TItem>.Add(TItem item) {
|
||||
throw new NotSupportedException(
|
||||
"Adding items is not supported by the read-only List"
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>Removes all items from the List</summary>
|
||||
void ICollection<ItemType>.Clear() {
|
||||
void ICollection<TItem>.Clear() {
|
||||
throw new NotSupportedException(
|
||||
"Clearing is not supported by the read-only List"
|
||||
);
|
||||
|
|
@ -89,7 +89,7 @@ namespace Nuclex.Support.Collections {
|
|||
/// <summary>Removes the specified item from the List</summary>
|
||||
/// <param name="item">Item that will be removed from the List</param>
|
||||
/// <returns>True of the specified item was found in the List and removed</returns>
|
||||
bool ICollection<ItemType>.Remove(ItemType item) {
|
||||
bool ICollection<TItem>.Remove(TItem item) {
|
||||
throw new NotSupportedException(
|
||||
"Removing items is not supported by the read-only List"
|
||||
);
|
||||
|
|
@ -131,7 +131,7 @@ namespace Nuclex.Support.Collections {
|
|||
#endregion
|
||||
|
||||
/// <summary>The wrapped Collection under its type-safe interface</summary>
|
||||
private ICollection<ItemType> typedCollection;
|
||||
private ICollection<TItem> typedCollection;
|
||||
/// <summary>The wrapped Collection under its object interface</summary>
|
||||
private ICollection objectCollection;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue