# HG changeset patch # User IBBoard # Date 1282415671 0 # Node ID 1575d57a8423498ddaf832080e0203d911de4628 # Parent cd96f6078edbd51c1dbf42a6b876292dfe4ba4c9 Re #12: Document classes and methods * Document Arrays class and methods diff -r cd96f6078edb -r 1575d57a8423 Arrays.cs --- 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 description for Arrays. + /// Helper methods for doing maths set-type operations on arrays. /// public class Arrays { + /// + /// Subtract one array of items from another array of items and return them in a new array. + /// + /// + /// The array of items to subtract from + /// + /// + /// The array of items to subtract + /// + /// + /// The type of the items in the arrays + /// public static T[] Subtract(T[] items, T[] subtract) { List arr = new List(); @@ -24,7 +36,19 @@ return arr.ToArray(); } - + + /// + /// Gets the objects that are not common to both arrays and returns them in a new array + /// + /// + /// The first array of objects + /// + /// + /// The second array of objects + /// + /// + /// The type of the items in the arrays + /// public static T[] Difference(T[] items1, T[] items2) { T[] diffObjs; @@ -64,11 +88,38 @@ return arr.ToArray(); } + /// + /// Gets the index of an item in an array, or -1 if the item isn't in the array + /// + /// + /// The index of the item, or -1 if the item isn't in the array + /// + /// + /// The array of items to find the item in + /// + /// + /// The item to find + /// + /// + /// The type of the items in the arrays + /// public static int IndexOf(T[] items, T item) { return Array.IndexOf(items, item); } - + + /// + /// Tests whether an array of items contains an item + /// + /// + /// The array of items to find the item in + /// + /// + /// The item to find + /// + /// + /// The type of the items in the arrays + /// public static bool Contains(T[] items, T item) { return IndexOf(items, item) != -1;