Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / ServiceModel / System / ServiceModel / Channels / MessageProperties.cs / 1 / MessageProperties.cs
//------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//-----------------------------------------------------------
namespace System.ServiceModel.Channels
{
using System.Xml;
using System.Collections;
using System.Collections.Generic;
using System.ServiceModel.Security;
public sealed class MessageProperties : IDictionary, IDisposable
{
Property[] properties;
int propertyCount;
MessageEncoder encoder;
Uri via;
object allowOutputBatching;
SecurityMessageProperty security;
bool disposed;
const int InitialPropertyCount = 2;
const int MaxRecycledArrayLength = 8;
const string ViaKey = "Via";
const string AllowOutputBatchingKey = "AllowOutputBatching";
const string SecurityKey = "Security";
const string EncoderKey = "Encoder";
const int NotFoundIndex = -1;
const int ViaIndex = -2;
const int AllowOutputBatchingIndex = -3;
const int SecurityIndex = -4;
const int EncoderIndex = -5;
static object trueBool = true;
static object falseBool = false;
public MessageProperties()
{
}
public MessageProperties(MessageProperties properties)
{
CopyProperties(properties);
}
internal MessageProperties(KeyValuePair[] array)
{
if (array == null)
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException("array"));
CopyProperties(array);
}
void ThrowDisposed()
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ObjectDisposedException(string.Empty, SR.GetString(SR.ObjectDisposed, this.GetType().ToString())));
}
public object this[string name]
{
get
{
if (disposed)
ThrowDisposed();
object value;
if (!TryGetValue(name, out value))
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentException(SR.GetString(SR.MessagePropertyNotFound, name)));
}
return value;
}
set
{
if (disposed)
ThrowDisposed();
UpdateProperty(name, value, false);
}
}
internal bool CanRecycle
{
get
{
return properties == null || properties.Length <= MaxRecycledArrayLength;
}
}
public int Count
{
get
{
if (disposed)
ThrowDisposed();
return propertyCount;
}
}
public MessageEncoder Encoder
{
get
{
if (disposed)
ThrowDisposed();
return encoder;
}
set
{
if (disposed)
ThrowDisposed();
AdjustPropertyCount((object)encoder == null, (object)value == null);
encoder = value;
}
}
public bool AllowOutputBatching
{
get
{
if (disposed)
ThrowDisposed();
return (object)allowOutputBatching == trueBool;
}
set
{
if (disposed)
ThrowDisposed();
AdjustPropertyCount((object)allowOutputBatching == null, false);
if (value)
{
allowOutputBatching = trueBool;
}
else
{
allowOutputBatching = falseBool;
}
}
}
public bool IsFixedSize
{
get
{
if (disposed)
ThrowDisposed();
return false;
}
}
public bool IsReadOnly
{
get
{
if (disposed)
ThrowDisposed();
return false;
}
}
public ICollection Keys
{
get
{
if (disposed)
ThrowDisposed();
List keys = new List();
if ((object)via != null)
{
keys.Add(ViaKey);
}
if ((object)allowOutputBatching != null)
{
keys.Add(AllowOutputBatchingKey);
}
if ((object)security != null)
{
keys.Add(SecurityKey);
}
if ((object)encoder != null)
{
keys.Add(EncoderKey);
}
if (properties != null)
{
for (int i = 0; i < properties.Length; i++)
{
string propertyName = properties[i].Name;
if (propertyName == null)
{
break;
}
keys.Add(propertyName);
}
}
return keys;
}
}
public SecurityMessageProperty Security
{
get
{
if (disposed)
ThrowDisposed();
return security;
}
set
{
if (disposed)
ThrowDisposed();
AdjustPropertyCount((object)security == null, (object)value == null);
security = value;
}
}
public ICollection
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- EventBindingService.cs
- SecurityUtils.cs
- XmlMemberMapping.cs
- Array.cs
- AttributeEmitter.cs
- ResourceDisplayNameAttribute.cs
- HtmlButton.cs
- InfoCardRSAPKCS1KeyExchangeDeformatter.cs
- XmlNotation.cs
- DrawingVisual.cs
- thaishape.cs
- ResourceKey.cs
- Assembly.cs
- Accessible.cs
- ComboBoxHelper.cs
- EntityCollection.cs
- Stylesheet.cs
- XmlSchemaSet.cs
- FontInfo.cs
- MessageLogger.cs
- BaseTemplateCodeDomTreeGenerator.cs
- DefaultBindingPropertyAttribute.cs
- ComponentGuaranteesAttribute.cs
- Ref.cs
- SafeArchiveContext.cs
- UnsignedPublishLicense.cs
- GroupBoxAutomationPeer.cs
- _NetworkingPerfCounters.cs
- EventlogProvider.cs
- HelpProvider.cs
- ConfigXmlCDataSection.cs
- HttpModuleCollection.cs
- XmlAttributes.cs
- RootBrowserWindowProxy.cs
- PenContext.cs
- DockPanel.cs
- SoapSchemaMember.cs
- PriorityQueue.cs
- BrowserDefinition.cs
- CompoundFileDeflateTransform.cs
- DynamicPropertyReader.cs
- AssemblyResourceLoader.cs
- SurrogateDataContract.cs
- DLinqTableProvider.cs
- NotEqual.cs
- MemoryMappedViewStream.cs
- InvalidFilterCriteriaException.cs
- FSWPathEditor.cs
- TextContainerHelper.cs
- BuiltInExpr.cs
- ContentValidator.cs
- PassportAuthentication.cs
- UnsafeNativeMethods.cs
- SubMenuStyleCollection.cs
- XmlHierarchicalDataSourceView.cs
- XmlWriterDelegator.cs
- HostedTcpTransportManager.cs
- Utils.cs
- TextTreeUndoUnit.cs
- DateTimeOffset.cs
- SweepDirectionValidation.cs
- TemplatedMailWebEventProvider.cs
- SoapDocumentServiceAttribute.cs
- NaturalLanguageHyphenator.cs
- log.cs
- SqlDataSourceQueryEditor.cs
- WebPartMenuStyle.cs
- Location.cs
- ReceiveReply.cs
- Math.cs
- ContentType.cs
- IProvider.cs
- XmlC14NWriter.cs
- FontEmbeddingManager.cs
- TextCharacters.cs
- FileFormatException.cs
- PathFigureCollection.cs
- DataTemplate.cs
- Grant.cs
- GridViewDeleteEventArgs.cs
- StylusPlugin.cs
- Int16Storage.cs
- OleDbCommand.cs
- UnsafeNetInfoNativeMethods.cs
- NamespaceCollection.cs
- XmlSchemaDocumentation.cs
- HttpHandlerAction.cs
- CapabilitiesSection.cs
- XPathExpr.cs
- SimpleBitVector32.cs
- SqlCacheDependency.cs
- AppSettingsSection.cs
- ContextMenuStripGroupCollection.cs
- pingexception.cs
- NullableDecimalAverageAggregationOperator.cs
- RadioButton.cs
- ServerIdentity.cs
- OptimalBreakSession.cs
- UInt16Storage.cs
- WindowsFont.cs