IZennoList
Assembly: ZennoLab.InterfacesLibrary
Full name: ZennoLab.InterfacesLibrary.ProjectModel.IZennoList
Kind: interface
Represents the data of the list. Provides method for binding data.
This interface can be used in action OwnCode (C# or PHP) of ProjectMaker.
Methods
Bind
Method
void Bind(string filename)
Binds the specified file to current list.
Parameters
| Type | Name | Description |
|---|---|---|
string | filename | The file name for bind data. |
Example
// get the list
var list = project.Lists["List 1"];
// bind
list.Bind("C:\\mylist.txt");Example2
// get the list
$list = $project->Lists->get_Item("List 1");
// bind
$list->Bind("C:\\mylist.txt");AddRange
Method
void AddRange(IEnumerable<string> range)
Adds the elements from IEnumerable
The order of the elements in the collection is preserved in the IZennoList.
Parameters
| Type | Name | Description |
|---|---|---|
IEnumerable<string> | range | The collection whose elements should be added to the end of the IZennoList. The collection itself cannot be null, but it can contain elements that are null. |
Example
// create an array of string for adding
string[] items = new string[3] { "one", "two", "three" };
// add range of the string to the project list
project.Lists["List 1"].AddRange(items);
// create a list of string
List<string> list = new List<string> { "four", "five", "six" };
// add list of string to the project list
project.Lists["List 1"].AddRange(list);Example2
// create an array of string for adding
$items = array( "one", "two", "three" );
// add range of the string to the project list
$project->Lists->get_Item("List 1")->AddRange($items);
// create a list of string
$list = new System\Collections\Generic\List<string> { "four", "five", "six" };
// add list of string to the project list
$project->Lists->get_Item("List 1")->AddRange($list);AddRange
Method
void AddRange(IZennoList list)
Adds the elements from IZennoList collection of the specified collection to the end of IZennoList.
The order of the elements in the collection is preserved in the IZennoList.
Parameters
| Type | Name | Description |
|---|---|---|
IZennoList | list | The collection whose elements should be added to the end of the IZennoList. The collection itself cannot be null, but it can contain elements that are null. |
Example
// add all items from project with name "List 2"
// to the project list with name "List 1"
project.Lists["List 1"].AddRange(project.Lists["List 2"]);Example2
// add all items from project with name "List 2"
// to the project list with name "List 1"
$project->Lists->get_Item("List 1")->AddRange($project->Lists->get_Item("List 2"));GetItem
Method
string GetItem(string filter, bool removeItem)
Gets the first item from the list satisfies the filter.
Parameters
| Type | Name | Description |
|---|---|---|
string | filter | The filter of range. |
bool | removeItem | true if need to remove the item, otherwise and default false. |
Returns: The requried item of list, or an empty string, if the item is not found.
Example
// gets random item from several ranges of the list
return project.Lists["List 1"].GetItem("random1(1,12-15,35-end)");Example2
// gets random item from several ranges of the list
return $project->Lists->get_Item("List 1")->GetItem("random1(1,12-15,35-end)");GetItems
Method
IEnumerable<string> GetItems(string filter, bool removeItems)
Gets items from the list satisfies the filter.
Parameters
| Type | Name | Description |
|---|---|---|
string | filter | The filter of range. |
bool | removeItems | true if need to remove the items, otherwise and default false. |
Returns: The collection of requried elements.
Example
// gets 20 random items from several ranges of the list
return string.Join(";", project.Lists["List 1"].GetItems("random20(1,12-15,35-end)"));Example2
// gets 20 random items from several ranges of the list
return String::Join(";", $project->Lists->get_Item("List 1")->GetItems("random20(1,12-15,35-end)"));Add
Method
void Add(object item)
Adds the element to the interface .
Parameters
| Type | Name | Description |
|---|---|---|
object | item | Object that will be added to the interface . |