EasyManuals Logo

Siemens SIMATIC S7 User Guide

Siemens SIMATIC S7
134 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #77 background imageLoading...
Page #77 background image
SIMATIC Automation Tool API for .NET framework
6.6 The IProfinetDeviceCollection class
SIMATIC Automation Tool V2.1 user guide
Manual, V2.1.1 07/2016, A5E33042676-AC
77
6.6
The IProfinetDeviceCollection class
6.6.1
Iterating items in the collection
The ScanNetworkDevices method outputs an object of type IProfinetDeviceCollection. This
class provides the ability to iterate the items in the collection in multiple ways. It also
provides methods to "filter" the items in the collection based on certain criteria. The following
sections describe the functionality available for the collection.
Consider the example code from the ScanNetworkDevices method:
IProfinetDeviceCollection scannedDevices = new IProfinetDeviceCollection();
Result retVal = myNetwork.ScanNetworkDevices(out scannedDevices);
For those programmers that prefer array-like syntax, the items in
scannedDevices can be
accessed as follows:
if (retVal.Succeeded)
{
for (int deviceIdx = 0; deviceIdx < scannedDevices.Count; deviceIdx++)
{
//----------------------------------------------------------
// Each item in the collection is an IProfinetDevice.
//----------------------------------------------------------
IProfinetDevice dev = scannedDevices[deviceIdx];
}
}
The collection also supports iteration using the
foreach syntax. The following example shows
the same collection iterated using this syntax:
foreach (IProfinetDevice dev in scannedDevices)
{
//-----------------------------------------------------------
// The variable "dev" now represents the next collection item
//-----------------------------------------------------------
}

Table of Contents

Other manuals for Siemens SIMATIC S7

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Siemens SIMATIC S7 and is the answer not in the manual?

Siemens SIMATIC S7 Specifications

General IconGeneral
BrandSiemens
ModelSIMATIC S7
CategoryController
LanguageEnglish

Related product manuals