Improved documentation
git-svn-id: file:///srv/devel/repo-conversion/nusu@14 d2e56fa2-650e-0410-a79f-9358c0239efd
This commit is contained in:
parent
0008304d64
commit
88390bc38d
4 changed files with 47 additions and 19 deletions
|
@ -6,13 +6,29 @@ using System.Threading;
|
|||
|
||||
namespace Nuclex.Support.Collections {
|
||||
|
||||
/// <summary>Collection transforming the contents of another collection.</summary>
|
||||
/// <summary>Collection that transforms the contents of another collection.</summary>
|
||||
/// <typeparam name="ContainedItemType">
|
||||
/// Type of the items contained in the wrapped collection.
|
||||
/// </typeparam>
|
||||
/// <typeparam name="ExposedItemType">
|
||||
/// Type this collection exposes its items as.
|
||||
/// </typeparam>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// This collection is useful if you want to expose the objects of an arbitrary
|
||||
/// collection under a different type. It can be used, for example, to construct
|
||||
/// wrappers for the items in a collection on-the-fly, eliminating the need to
|
||||
/// manage the wrappers in parallel to the real items and improving performance
|
||||
/// by only constructing a wrapper when an item is actually requested.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// Another common use would be if you have a private collection of a non-public
|
||||
/// type that's derived from some publicly visible type. By using this collection,
|
||||
/// you can return the items under the publicly visible type while still having
|
||||
/// your private collection under the non-public type, eliminating the need to
|
||||
/// downcast each time you need to access elements of the non-public type.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
public abstract class TransformingReadOnlyCollection<ContainedItemType, ExposedItemType> :
|
||||
IList<ExposedItemType>, IList {
|
||||
|
||||
|
@ -241,23 +257,6 @@ namespace Nuclex.Support.Collections {
|
|||
/// </remarks>
|
||||
protected abstract ExposedItemType Transform(ContainedItemType item);
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the object is compatible to the collection's data type.
|
||||
/// </summary>
|
||||
/// <param name="value">Object to check for compatibility.</param>
|
||||
/// <returns>
|
||||
/// True if the object is compatible to the collection's data type;
|
||||
/// otherwise false.
|
||||
/// </returns>
|
||||
private static bool IsCompatibleObject(object value) {
|
||||
if(!(value is ExposedItemType)) {
|
||||
if((value != null) || typeof(ExposedItemType).IsValueType) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
#region IList<ExposedItemType> Members
|
||||
|
||||
/// <summary>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue