Get the list by the specified name.
| C# | |
|---|---|
IList<string> this[ string listName ]; {get;} | |
Parameters
- listName
Type: System.String
The name of list.
Property Value
Type: IList
The list of items.
| Exception | Description |
|---|---|
| KeyNotFoundException | The exception that is thrown when the name specified for accessing a list in a collection does not match any name in the collection. |
The following example uses property "Item" (operator []) to access a list with name "MyList".
| C# | Copy Code |
|---|---|
// get list var list = project.Lists["MyList"]; // result string result = String.Empty; if (list.Count > 0) { foreach (string str in list) { if (String.IsNullOrWhiteSpace(result)) result = str; else result = String.Format("{0}:{1}", result, str); } } // return result return result; | |
| PHP | Copy Code |
|---|---|
// get list $list = $project->Lists->get_Item("MyList"); // result $result = String::Empty; if ($list->Count > 0) { foreach ($str as $list) { if (String::IsNullOrWhiteSpace($result)) $result = $str; else $result = String::Format("{0}:{1}", $result, $str); } } // return result return $result; | |
Target Platforms: Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family, Windows Seven