问题描述
我正在尝试使用此博客更改一些自定义消息编码器
I am trying to change some custommessage encoder Using this blog
http://www.falconwebtech.com/post/2010/05/24/WCF-Interoperability-and-Extensibility-Part-Two.aspx
作者在这里使用扩展方法
Here the author uses a extension method
xmlMessage.Descendants(sec + "Security").First().Add(samlXml);
我为此使用什么命名空间.这是我得到的错误
What namespace do I use for this .FirstThis is the error I am getting
'System.Collections.Generic.IEnumerable'不包含'First'的定义,也没有扩展方法'First'接受以下形式的第一个参数: 类型'System.Collections.Generic.IEnumerable' 可以找到(您是否缺少using指令或程序集引用?)
'System.Collections.Generic.IEnumerable' does not contain a definition for 'First' and no extension method 'First' accepting a first argument of type 'System.Collections.Generic.IEnumerable' could be found (are you missing a using directive or an assembly reference?)
我包含以下命名空间
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've done my research but I am taking the easy way
谢谢
推荐答案
System.Linq
是您所追求的.
http://msdn.microsoft.com/en-us/library/system.linq.enumerable.first.aspx
这篇关于System.Xml.Linq.XElement>'不包含"First"的定义,也没有扩展方法"First"接受以下项的第一个参数:的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!