【发布时间】:2009-05-06 15:50:27
【问题描述】:
嗨!我正在寻找一个文档来定义“rows[0]”这个词的含义。这是 Eclipse 框架中的 BIRT。也许这是一个 Javascript 词?我不知道...一直在疯狂地寻找,但什么也没找到。有什么想法吗?
【问题讨论】:
嗨!我正在寻找一个文档来定义“rows[0]”这个词的含义。这是 Eclipse 框架中的 BIRT。也许这是一个 Javascript 词?我不知道...一直在疯狂地寻找,但什么也没找到。有什么想法吗?
【问题讨论】:
rows 是 dataSet.rows 的快捷方式。返回与此报表项实例关联的数据集的当前数据行(DataRow[] 类型)。如果此报表元素没有数据集,则此属性未定义。
来源:http://www.eclipse.org/birt/phoenix/ref/ROM_Scripting_SPEC.pdf
【讨论】:
通常像 rows[x] 这样的代码会访问数组中的元素。任何编程书籍介绍都应该能够为您定义。
rows[0] 将访问数组中的 first 元素。
【讨论】:
该操作有多个名称,具体取决于语言,但通常是相同的概念。在 Java 中,它是 array access expression,在 C# 中是 indexer 或 array access operator。与几乎任何东西一样,C++ 更复杂,但基本上 [] 运算符获取某物或数组的集合,并拉出(或分配给)该集合或数组中的特定编号元素(通常从 0 开始)。所以在 C# 中...
// create a list of integers
List<int> lst = new List<int>() { 1, 2, 3, 4, 5 };
// access list
int x = lst[0]; // get the first element of the list, x = 1 afterwords
x = lst[2]; // get the third element of the list, x = 3 afterwords
x = lst[4]; // get the fifth element of the list, x = 5 afterwords
x = lst[5]; // IndexOutOfBounds Exception
【讨论】: