System.Xml.Linq.XElement> 'does not contain a definition for "First" and no extension method "First" that takes the first argument

I am trying to change some kind of custommessage encoder. Using this blog

http://www.falconwebtech.com/post/2010/05/24/WCF-Interoperability-and-Extensibility-Part-Two.aspx 

Here the author uses the extension method

  xmlMessage.Descendants(sec + "Security").First().Add(samlXml); 

What namespace do I use for this. This is the error I get

'System.Collections.Generic.IEnumerable' does not contain a definition for 'First' and there is no extension method 'First' that takes the first argument of type 'System.Collections.Generic.IEnumerable' (did you specify a usage directive or assembly reference?)

I have the following namespaces:

 using System; using System.IO; using System.Security.Cryptography; using System.ServiceModel.Channels; using System.Text; using System.Xml; using System.Xml.Linq; using System.Reflection; using System.Collections.Generic; using System.Xml.XPath; using System.Security.Cryptography.Xml; using System.Security.Cryptography.X509Certificates; using Microsoft.Web.Services3.Security; using System.ServiceModel.Security; using System.IdentityModel.Tokens; 

I could do my research, but I'm doing an easy way

thanks

+7
source share
1 answer
+20
source

All Articles