Difference between revisions of "CompatibilityArray class"

From Catglobe Wiki
Jump to: navigation, search
Line 27: Line 27:
 
{{CGscriptProperties_Template|ReturnType=TypeInformation|Name=<nowiki>TypeInformation</nowiki>|HasGetter=1|Description=<nowiki>Get information about this class.</nowiki>}}
 
{{CGscriptProperties_Template|ReturnType=TypeInformation|Name=<nowiki>TypeInformation</nowiki>|HasGetter=1|Description=<nowiki>Get information about this class.</nowiki>}}
 
}}
 
}}
 +
=== <span style="color:#DF8621">'''Examples'''</span> ===
 +
<source lang="javascript">
 +
DataCacheSpecification dcs = new DataCacheSpecification (15636575);
 +
Axis axis = new Axis (dcs, "Gender", "Gender");
 +
axis.MathBase = "Gender";
 +
axis.PctBase = "Gender != empty";
 +
array options = axis.Options;
 +
options.Add(new AxisOption(dcs,"Male","Gender == 1"));
 +
options.AddRange({new AxisOption(dcs,"Male","Gender == 1"), new AxisOption(dcs,"Female","Gender == 2")});
 +
options.RemoveItemAt(0);
 +
axis.Options = options;
 +
axis.AddOrUpdateAxisInAxisSet();
 +
dcs.Save();
 +
</source>

Revision as of 05:00, 24 July 2018

CompatibilityArray



Maps cgs array to internal list for compatibility.


Methods

  • Empty Add(object element "element to add") - Add a new element to the Array
  • Empty AddRange(array source "Array to get elements from.") - Add all elements of another array to this array.
  • bool Contains(object element "Element to check for") - Return true if the array contains the element using the normal equal operator.
  • object this[] { get; }(int index "Index") - Backward-compatible indexer
  • Empty RemoveItemAt(int index "The index to remove the object from") - Remove an element from the Array
  • Empty this[] { set; }(int index "Index", object value "Value to set") - Backward-compatible indexer
  • string ToString() - The string representation of the object.

Properties

  • int Count { get; } - Number of elements in Array
  • string ObjectTypeName { get; } - The name of the type of object.
  • TypeInformation TypeInformation { get; } - Get information about this class.

Examples

DataCacheSpecification dcs = new DataCacheSpecification (15636575);
Axis axis = new Axis (dcs, "Gender", "Gender");
axis.MathBase = "Gender";
axis.PctBase = "Gender != empty";
array options = axis.Options;
options.Add(new AxisOption(dcs,"Male","Gender == 1"));
options.AddRange({new AxisOption(dcs,"Male","Gender == 1"), new AxisOption(dcs,"Female","Gender == 2")});
options.RemoveItemAt(0);
axis.Options = options;
axis.AddOrUpdateAxisInAxisSet();
dcs.Save();