13.07.2015 Views

5 Model Programs

5 Model Programs

5 Model Programs

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

302 <strong>Model</strong>ing Library ReferenceCountReturns the number of elements in the value array.IsEmptyReturns true if the value array has no elements. Returns false otherwise.Item(int)Lengthetc. . . .A.2.6BagBagAn unordered collection of possibly repeating elements. This is also known as amultiset. The type is immutable; add/remove methods return a new bag.Syntaxpublic sealed class Bag : CollectionValueConstructorsBag()Constructs an empty bag. The static field Bag.EmptyBag is preferred insteadof using this form of the constructor.Bag(IEnumerable)Constructs a bag with elements taken from a collection. The Count of the resultingbag will be the same as the number of values in the collection given as theargument.Bag(T[])Constructs a bag with elements given as params arguments. The Count of thebag will be the same as the number of arguments to the constructor.Bag(IEnumerable)Constructs a bag with elements and their corresponding multiplicities given asa pair enumeration.Bag(Pair[])Constructs a bag with params arguments that are pairs of elements and theircorresponding multiplicities.MethodsThe following entries describe some of the methods of this type. Many more aredescribed in the library documentation.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!