Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / ServiceModel / System / ServiceModel / Configuration / AddressHeaderCollectionElement.cs / 1 / AddressHeaderCollectionElement.cs
//------------------------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------------------------- namespace System.ServiceModel.Configuration { using System; using System.Configuration; using System.ServiceModel.Channels; using System.Xml; using System.Security; public sealed partial class AddressHeaderCollectionElement : ConfigurationElement { public AddressHeaderCollectionElement() { } [ConfigurationProperty(ConfigurationStrings.Headers, DefaultValue = null)] public AddressHeaderCollection Headers { get { AddressHeaderCollection retVal = (AddressHeaderCollection)base[ConfigurationStrings.Headers]; if (null == retVal) { retVal = AddressHeaderCollection.EmptyHeaderCollection; } return retVal; } set { if (value == null) { value = AddressHeaderCollection.EmptyHeaderCollection; } base[ConfigurationStrings.Headers] = value; } } ////// Critical - uses the critical helper SetIsPresent /// Safe - controls how/when SetIsPresent is used, not arbitrarily callable from PT (method is protected and class is sealed) /// [SecurityCritical, SecurityTreatAsSafe] protected override void DeserializeElement(XmlReader reader, bool serializeCollectionKey) { SetIsPresent(); DeserializeElementCore(reader); } private void DeserializeElementCore(XmlReader reader) { this.Headers = AddressHeaderCollection.ReadServiceParameters(XmlDictionaryReader.CreateDictionaryReader(reader)); } ////// Critical - calls ConfigurationHelpers.SetIsPresent which elevates in order to set a property /// Safe - only passes 'this', does not let caller influence parameter /// [SecurityCritical] void SetIsPresent() { ConfigurationHelpers.SetIsPresent(this); } protected override bool SerializeToXmlElement(XmlWriter writer, String elementName) { bool dataToWrite = this.Headers.Count != 0; if (dataToWrite && writer != null) { writer.WriteStartElement(elementName); this.Headers.WriteContentsTo(XmlDictionaryWriter.CreateDictionaryWriter(writer)); writer.WriteEndElement(); } return dataToWrite; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu
![Network programming in C#, Network Programming in VB.NET, Network Programming in .NET](/images/book.jpg)
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- DataSourceXmlAttributeAttribute.cs
- ReflectPropertyDescriptor.cs
- WindowsGraphicsCacheManager.cs
- Thumb.cs
- PolyBezierSegmentFigureLogic.cs
- XmlSchemaInferenceException.cs
- CombinedGeometry.cs
- IndexedString.cs
- RuntimeConfigLKG.cs
- HtmlMeta.cs
- AccessDataSourceDesigner.cs
- TextChangedEventArgs.cs
- CustomErrorsSectionWrapper.cs
- Span.cs
- TdsRecordBufferSetter.cs
- DataGridSortCommandEventArgs.cs
- DisplayNameAttribute.cs
- SurrogateSelector.cs
- XmlCharacterData.cs
- Main.cs
- TileBrush.cs
- HashMembershipCondition.cs
- OwnerDrawPropertyBag.cs
- XmlWhitespace.cs
- wgx_commands.cs
- AssertSection.cs
- ResourceExpression.cs
- GenericEnumConverter.cs
- TabletCollection.cs
- WebPartConnectionsConfigureVerb.cs
- ObjectDataSourceView.cs
- Hyperlink.cs
- NativeMethods.cs
- ExternalException.cs
- GenericsInstances.cs
- _Semaphore.cs
- ShapeTypeface.cs
- XmlSchemaGroupRef.cs
- ConfigurationSectionGroup.cs
- ObjectDataSourceStatusEventArgs.cs
- QueryExecutionOption.cs
- Item.cs
- AnnouncementEventArgs.cs
- QueryExtender.cs
- DoubleAnimationBase.cs
- DataServiceExpressionVisitor.cs
- Ref.cs
- PocoEntityKeyStrategy.cs
- ContextDataSourceView.cs
- StrongNameMembershipCondition.cs
- UserControl.cs
- XPathLexer.cs
- Roles.cs
- ApplicationId.cs
- StrokeCollectionConverter.cs
- SynchronizedRandom.cs
- Animatable.cs
- Grant.cs
- AuthorizationSection.cs
- IListConverters.cs
- WasHttpHandlersInstallComponent.cs
- StorageRoot.cs
- Identity.cs
- ObjectAnimationUsingKeyFrames.cs
- PropertyMappingExceptionEventArgs.cs
- TextTreeUndoUnit.cs
- SqlUtils.cs
- StandardToolWindows.cs
- ComponentManagerBroker.cs
- Wildcard.cs
- Rotation3DAnimation.cs
- DateTimeParse.cs
- ProtocolsConfigurationHandler.cs
- DataServiceEntityAttribute.cs
- DefaultParameterValueAttribute.cs
- NotCondition.cs
- GeneralTransform.cs
- SQLBytesStorage.cs
- DataSetViewSchema.cs
- ArrayHelper.cs
- EditorAttribute.cs
- WindowsUserNameSecurityTokenAuthenticator.cs
- ActiveXMessageFormatter.cs
- TemplatedControlDesigner.cs
- BitmapMetadataEnumerator.cs
- LineInfo.cs
- ModifiableIteratorCollection.cs
- RemoteArgument.cs
- ViewUtilities.cs
- ArrayConverter.cs
- InternalTypeHelper.cs
- CodeMemberEvent.cs
- RoleGroupCollection.cs
- XmlSchemaObjectCollection.cs
- DataGridViewHitTestInfo.cs
- IisTraceWebEventProvider.cs
- CellCreator.cs
- Invariant.cs
- ObservableCollection.cs
- InstanceNotReadyException.cs