Features working with an array of datalow

basic functionality for working with arrays of objects metalowych

DetailArray supports basic functionality for working with arrays metalowych close

  • Support links to hat (aggregator).
  • Support for collections:
  • add (AddObject, AddRange),
  • insert (Insert),
  • delete (Remove RemoveByIndex, RemoveByKey),
  • clear (Clear),
  • install/capture values (GetByKey, SetByKey),
  • move (Move)
  • the number of objects (Count),
  • iterates through the objects in the foreach construct.
  • Support the ordering (the order in which lie data objects).

Aggregate functions

Among the objects in the array datalow, calculate some aggregate function (sum, max, min, mean, anything random), it is necessary in the class inherited from DetailArray, to define a function without parameters that returns a value. Further to this function, you must attribute the attribute AggregationFunction. Parameters are: name of the property for which this aggregation function, and a format string (String.Format), according to which the value is displayed to the user.

Ordering

The objects in the array of datalow can be ordered (it is ordered but not sorted), i.e., be placed in any strict order.

In order to introduce a regularization, it is necessary to metalowy class of data to enter an integer (System.Int32) property with assigned attribute Order.

get type DetailArray its name

To get the type of detail, having the type of aggregator and the name DetailArray, it is necessary to use the method of Information.GetItemType.

Method signature:

public static System.Type ICSSoft.STORMNET.Information.GetItemType (
        System.Type AgregatorType,
        string DetailPropertyName ) 	

where AgregatorType is the class type of the aggregator, and DetailPropertyName is the name of the list of datalow whose type to get.

The method returns an object of type System.Type containing a description of the type of detail.

Writing LINQ queries to the already made list DetailArrayOf…

To write a LINQ query to detalam, you must first bring them to the required type (because DetailArrayOf… does not support the interface IEnumerable, directly to him LINQ methods (such as Select, ToList, etc.) will not apply).

Suppose there is a class Aggregator having metalowy class Det, then the construction below will give ошибку, because it is necessary to specify the type of objects which will populate a new list:

Aggregator aggr = new Aggregator();
aggr.DetailArrayOfDet.ToList(); 

If you specify a type, then ошибка changes to Невозможно lead type DetailArrayOfDet type IEnumerable&lt<Det>:

Aggregator aggr = new Aggregator();
aggr.DetailArrayOfDet.ToList<Det>(); 

Правильным способом is:

Aggregator aggr = new Aggregator();
aggr.DetailArrayOfDet.Cast<Det>.ToList();