📄 reportsectioncollection.cs
字号:
/*
* Created by SharpDevelop.
* User: Forstmeier Peter
* Date: 28.02.2005
* Time: 22:13
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;
using System.Collections;
namespace SharpReportCore{
/// <summary>
/// A collection that stores <see cref='BaseReportObject'/> objects.
/// </summary>
[Serializable()]
public class ReportSectionCollection : CollectionBase {
public ReportSectionCollection(){
}
/// <summary>
/// Adds a <see cref='BaseReportObject'/> with the specified value to the
/// <see cref='old_BaseReportObjectCollection'/>.
/// </summary>
/// <param name='val'>The <see cref='BaseReportObject'/> to add.</param>
/// <returns>The index at which the new element was inserted.</returns>
/// <seealso cref='old_BaseReportObjectCollection.AddRange'/>
public int Add(BaseReportObject val){
return List.Add(val);
}
/// <summary>
/// Represents the entry at the specified index of the <see cref='BaseReportObject'/>.
/// </summary>
/// <param name='index'>The zero-based index of the entry to locate in the collection.</param>
/// <value>The entry at the specified index of the collection.</value>
/// <exception cref='ArgumentOutOfRangeException'><paramref name='index'/> is outside the valid range of indexes for the collection.</exception>
public BaseReportObject this[int index] {
get {
return ((BaseReportObject)(List[index]));
}
set {
List[index] = value;
}
}
private int FindByName (string name) {
for (int i = 0;i < List.Count ;i++ ) {
if (((BaseReportObject)List[i]).Name== name) {
return i;
}
}
return -1;
}
public BaseReportObject this[string sectionName] {
get {
int i = FindByName (sectionName);
if ( i > -1 ){
return(BaseReportObject)List[i];
}
return null;
}
set {
int i = FindByName (sectionName);
if ( i > 0 ){
List[i] = value;
}
}
}
public bool Contains(BaseReportObject val){
return List.Contains(val);
}
/// <summary>
/// Copies the <see cref='old_BaseReportObjectCollection'/> values to a one-dimensional <see cref='Array'/> instance at the
/// specified index.
/// </summary>
/// <param name='array'>The one-dimensional <see cref='Array'/> that is the destination of the values copied from <see cref='old_BaseReportObjectCollection'/>.</param>
/// <param name='index'>The index in <paramref name='array'/> where copying begins.</param>
/// <exception cref='ArgumentException'>
/// <para><paramref name='array'/> is multidimensional.</para>
/// <para>-or-</para>
/// <para>The number of elements in the <see cref='old_BaseReportObjectCollection'/> is greater than
/// the available space between <paramref name='arrayIndex'/> and the end of
/// <paramref name='array'/>.</para>
/// </exception>
/// <exception cref='ArgumentNullException'><paramref name='array'/> is <see langword='null'/>. </exception>
/// <exception cref='ArgumentOutOfRangeException'><paramref name='arrayIndex'/> is less than <paramref name='array'/>'s lowbound. </exception>
/// <seealso cref='Array'/>
public void CopyTo(BaseReportObject[] array, int index){
List.CopyTo(array, index);
}
/// <summary>
/// Returns the index of a <see cref='BaseReportObject'/> in
/// the <see cref='old_BaseReportObjectCollection'/>.
/// </summary>
/// <param name='val'>The <see cref='BaseReportObject'/> to locate.</param>
/// <returns>
/// The index of the <see cref='BaseReportObject'/> of <paramref name='val'/> in the
/// <see cref='old_BaseReportObjectCollection'/>, if found; otherwise, -1.
/// </returns>
/// <seealso cref='old_BaseReportObjectCollection.Contains'/>
public int IndexOf(BaseReportObject val){
return List.IndexOf(val);
}
/// <summary>
/// Removes a specific <see cref='BaseReportObject'/> from the <see cref='old_BaseReportObjectCollection'/>.
/// </summary>
/// <param name='val'>The <see cref='BaseReportObject'/> to remove from the <see cref='old_BaseReportObjectCollection'/>.</param>
/// <exception cref='ArgumentException'><paramref name='val'/> is not found in the Collection.</exception>
public void Remove(BaseReportObject val){
List.Remove(val);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -