本文整理汇总了C#中System.ServiceModel.MessageHeaderAttribute类的典型用法代码示例。如果您正苦于以下问题:C# MessageHeaderAttribute类的具体用法?C# MessageHeaderAttribute怎么用?C# MessageHeaderAttribute使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MessageHeaderAttribute类属于System.ServiceModel命名空间,在下文中一共展示了MessageHeaderAttribute类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1:
[MessageContract]
public class HelloResponseMessage
{
private string localResponse = String.Empty;
private string extra = String.Empty;
[MessageBodyMember(
Name = "ResponseToGreeting",
Namespace = "http://www.examples.com")]
public string Response
{
get { return localResponse; }
set { localResponse = value; }
}
[MessageHeader(
Name = "OutOfBandData",
Namespace = "http://www.examples.com",
MustUnderstand=true
)]
public string ExtraValues
{
get { return extra; }
set { this.extra = value; }
}
/*
The following is the response message, edited for clarity.
<s:Envelope>
<s:Header>
<a:Action s:mustUnderstand="1">http://HelloResponseMessage/Action</a:Action>
<h:OutOfBandData s:mustUnderstand="1" xmlns:h="http://www.examples.com">Served by object 13804354.</h:OutOfBandData>
</s:Header>
<s:Body>
<HelloResponseMessage xmlns="Microsoft.WCF.Documentation">
<ResponseToGreeting xmlns="http://www.examples.com">Service received: Hello.</ResponseToGreeting>
</HelloResponseMessage>
</s:Body>
</s:Envelope>
*/
}