AlistairFrith

Has AFAttribute.FirstOrDefaulr changed in AF2012?

Discussion created by AlistairFrith on Jun 24, 2013
Latest reply on Jun 24, 2013 by LMouxDominguez

I have just upgraded the AFClient to 2012 in order to support my Custom Data Reference and I find that another part of the solution is now failing to compile. This line used to work:

 
                    AFAttribute results = afElement.Attributes.FirstOrDefault(a => a.Attributes.Select(k => k.Name.ToLower()).Any(b => b == KPI.ToLower()));

 but now it says

 

Error 388 'OSIsoft.AF.Asset.AFAttributes' does not contain a definition for 'FirstOrDefault' and no extension method 'FirstOrDefault' accepting a first argument of type 'OSIsoft.AF.Asset.AFAttributes' could be found (are you missing a using directive or an assembly reference?) C:\VSS\Customers\UK Power Networks\Standalone\NetVisSolution\NetVisSolution.root\NetVisSolution\NetVisSolution.Web\secure\CleansingDataService.svc.cs 103 43 NetVisSolution.Web

 

I have also tried 

 
AFAttribute results = afElement.Attributes.FirstOrDefault();

 which gives the same errors. It's almost as if FirstOrDefault() is no longer supported on AFAttributes in AF2012, even though the intellisense says it is.

 

Can anyone advise?

 

--- Alistair.

 

 

 

 

Outcomes