SDK 'list' object

Discussion created by CJaeger on May 29, 2009



After watching last day webinar (about webinar, i think you should inform on which 'skills level' each webinar are designed), i have a 'simple' question :


Why many 'list' objects of the SDK lack of 'searching' method ?


This is true for Servers,PIPoints,...


To illustrate the only search methods i found to be working on such objects:


Windows Console, add pisdk reference and fill the main with :

String _myServerName = "This is something really wrong !";
Server _srv = null;

// no Contains, TryGetValue or any other like method ?

#region Enumeration Method
foreach (Server srv in _sdk.Servers)
    if (srv.Name == _myServerName)
        _srv = srv;
// _srv == null if not found != null if found

#endregion Enumeration Method

#region TryCatch Method
    _srv = _sdk.Servers[_myServerName];
catch (Exception ex)
    //you can log something there with ex's value:
    //( {"The requested server was not found in the known servers table.
    // Unable to resolve name to IP address. This is something really wrong !"})
// _srv == null if not found != null if found
#endregion TryCatch Method

Enumeration method can be a hit on performance where there's many iterations (i.e. PIPoints)


TryCatch method is a misuse of original aim of trycatch and may hit performance due to context unload/reload.


Does someone else asked himself this question while programming w/ SDK ?


Anyone have a cleaner code to perform such simple operation ?


I know that there's specific fast way to get points (i.e _sdk.GetPoint method) but not every SDK list object have one. Moreover if recommandation is to use those specific methods instead of list access methods, why publish those lists as public ?