changeset 90:1575d57a8423

Re #12: Document classes and methods * Document Arrays class and methods
author IBBoard <dev@ibboard.co.uk>
date Sat, 21 Aug 2010 18:34:31 +0000
parents cd96f6078edb
children 0fcc795d5e1f
files Arrays.cs
diffstat 1 files changed, 54 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/Arrays.cs	Sat Aug 21 18:22:23 2010 +0000
+++ b/Arrays.cs	Sat Aug 21 18:34:31 2010 +0000
@@ -8,10 +8,22 @@
 namespace IBBoard
 {
 	/// <summary>
-	/// Summary description for Arrays.
+	/// Helper methods for doing maths set-type operations on arrays.
 	/// </summary>
 	public class Arrays
 	{
+		/// <summary>
+		/// Subtract one array of items from another array of items and return them in a new array.
+		/// </summary>
+		/// <param name='items'>
+		/// The array of items to subtract from
+		/// </param>
+		/// <param name='subtract'>
+		/// The array of items to subtract
+		/// </param>
+		/// <typeparam name='T'>
+		/// The type of the items in the arrays
+		/// </typeparam>
 		public static T[] Subtract<T>(T[] items, T[] subtract)
 		{
 			List<T> arr = new List<T>();
@@ -24,7 +36,19 @@
 
 			return arr.ToArray();
 		}
-
+		
+		/// <summary>
+		/// Gets the objects that are not common to both arrays and returns them in a new array
+		/// </summary>
+		/// <param name='items1'>
+		/// The first array of objects
+		/// </param>
+		/// <param name='items2'>
+		/// The second array of objects
+		/// </param>
+		/// <typeparam name='T'>
+		/// The type of the items in the arrays
+		/// </typeparam>
 		public static T[] Difference<T>(T[] items1, T[] items2)
 		{
 			T[] diffObjs;
@@ -64,11 +88,38 @@
 			return arr.ToArray();
 		}
 		
+		/// <summary>
+		/// Gets the index of an item in an array, or <code>-1</code> if the item isn't in the array
+		/// </summary>
+		/// <returns>
+		/// The index of the item, or <code>-1</code> if the item isn't in the array
+		/// </returns>
+		/// <param name='items'>
+		/// The array of items to find the item in
+		/// </param>
+		/// <param name='item'>
+		/// The item to find
+		/// </param>
+		/// <typeparam name='T'>
+		/// The type of the items in the arrays
+		/// </typeparam>
 		public static int IndexOf<T>(T[] items, T item)
 		{
 			return Array.IndexOf(items, item);
 		}
-
+		
+		/// <summary>
+		/// Tests whether an array of items contains an item
+		/// </summary>
+		/// <param name='items'>
+		/// The array of items to find the item in
+		/// </param>
+		/// <param name='item'>
+		/// The item to find
+		/// </param>
+		/// <typeparam name='T'>
+		/// The type of the items in the arrays
+		/// </typeparam>
 		public static bool Contains<T>(T[] items, T item)
 		{
 			return IndexOf(items, item) != -1;