using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;
using FastReport.Utils;
namespace FastReport.Data
{
///
/// Represents the collection of objects.
///
///
/// This class is used to store the list of parameters defined in the datasource. See the
/// property for more details.
///
public class CommandParameterCollection : FRCollectionBase
{
///
/// Gets or sets a parameter.
///
/// The index of a parameter in this collection.
/// The parameter with specified index.
public CommandParameter this[int index]
{
get { return List[index] as CommandParameter; }
set { List[index] = value; }
}
///
/// Finds a parameter by its name.
///
/// The name of a parameter.
/// The object if found; otherwise null.
public CommandParameter FindByName(string name)
{
foreach (CommandParameter c in this)
{
if (c.Name == name)
return c;
}
return null;
}
///
/// Returns an unique parameter name based on given name.
///
/// The base name.
/// The unique name.
public string CreateUniqueName(string name)
{
string baseName = name;
int i = 1;
while (FindByName(name) != null)
{
name = baseName + i.ToString();
i++;
}
return name;
}
///
/// Initializes a new instance of the class with default settings.
///
/// The owner of this collection.
public CommandParameterCollection(Base owner) : base(owner)
{
}
}
}