ImportCollection.Item Property
Gets or sets the value of an Import at the specified zero-based index.
[C#] In C#, this property is the indexer for the ImportCollection class.
[Visual Basic] Public Default Property Item( _ ByVal index As Integer _ ) As Import [C#] public Import this[ int index ] {get; set;} [C++] public: __property Import* get_Item( int index ); public: __property void set_Item( int index, Import* ); [JScript] returnValue = ImportCollectionObject.Item(index); ImportCollectionObject.Item(index) = returnValue; -or- returnValue = ImportCollectionObject(index); ImportCollectionObject(index) = returnValue;
[JScript] In JScript, you can use the default indexed properties defined by a type, but you cannot explicitly define your own. However, specifying the expando attribute on a class automatically provides a default indexed property whose type is Object and whose index type is String.
Arguments [JScript]
- index
- The zero-based index of the Import whose value is modified or returned.
Parameters [Visual Basic, C#, C++]
- index
- The zero-based index of the Import whose value is modified or returned.
Property Value
An Import.
Example
[Visual Basic, C#, C++] The following example demonstrates the use of a zero-based index to iterate through the members of the ImportCollection.
[Visual Basic] ' Get Import Collection. Dim myImportCollection As ImportCollection = myServiceDescription.Imports Console.WriteLine("Total Imports in the document = " + _ myServiceDescription.Imports.Count.ToString()) ' Print 'Import' properties to console. Dim i As Integer For i = 0 To myImportCollection.Count - 1 Console.WriteLine(ControlChars.Tab + _ "Import Namespace :{0} Import Location :{1} ", _ myImportCollection(i).Namespace, _ myImportCollection(i).Location) Next i [C#] // Get Import Collection. ImportCollection myImportCollection = myServiceDescription.Imports; Console.WriteLine("Total Imports in the document = " + myServiceDescription.Imports.Count); // Print 'Import' properties to console. for(int i =0; i < myImportCollection.Count; ++i) Console.WriteLine("\tImport Namespace :{0} Import Location :{1} " ,myImportCollection[i].Namespace ,myImportCollection[i].Location); [C++] // Get Import Collection. ImportCollection * myImportCollection = myServiceDescription->Imports; Console::WriteLine(S"Total Imports in the document = {0}", __box(myServiceDescription -> Imports->Count)); // Print 'Import' properties to console. for (int i = 0; i < myImportCollection->Count; ++i) Console::WriteLine(S"\tImport Namespace : {0} Import Location : {1} " , myImportCollection->Item[i]->Namespace , myImportCollection->Item[i]->Location);
[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button
in the upper-left corner of the page.
Requirements
Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family
See Also
ImportCollection Class | ImportCollection Members | System.Web.Services.Description Namespace