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
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- GetPageNumberCompletedEventArgs.cs
- ListManagerBindingsCollection.cs
- TraceContextEventArgs.cs
- GPRECT.cs
- DynamicPropertyHolder.cs
- ScrollData.cs
- Literal.cs
- AnimationLayer.cs
- InvalidDataException.cs
- XmlAttributeProperties.cs
- SmiTypedGetterSetter.cs
- FixedSOMPageConstructor.cs
- ObjectItemConventionAssemblyLoader.cs
- RequestDescription.cs
- TimeEnumHelper.cs
- TextOptionsInternal.cs
- HttpProcessUtility.cs
- UserControlParser.cs
- CryptoStream.cs
- AnnotationElement.cs
- TextRange.cs
- BamlRecordWriter.cs
- ObjectSecurity.cs
- CacheSection.cs
- SqlDataSourceCustomCommandEditor.cs
- UpdateException.cs
- ScrollableControl.cs
- BaseHashHelper.cs
- CodeCompiler.cs
- ActivityWithResultWrapper.cs
- NativeMethods.cs
- QueryUtil.cs
- LeftCellWrapper.cs
- RoleManagerSection.cs
- Object.cs
- PeerNearMe.cs
- XmlObjectSerializerReadContext.cs
- WindowsNonControl.cs
- WebPartConnectionCollection.cs
- RightsManagementEncryptionTransform.cs
- HttpServerUtilityBase.cs
- NumericPagerField.cs
- securestring.cs
- Stack.cs
- XPathNodeList.cs
- StubHelpers.cs
- GeometryCombineModeValidation.cs
- UnknownBitmapDecoder.cs
- LayoutEvent.cs
- WindowsSecurityTokenAuthenticator.cs
- XmlChildNodes.cs
- DataControlField.cs
- XmlSerializationGeneratedCode.cs
- FileUtil.cs
- Graph.cs
- TrustManager.cs
- HttpFileCollection.cs
- TCPListener.cs
- Events.cs
- XmlSchemaObjectTable.cs
- SqlDataSource.cs
- ProcessHostConfigUtils.cs
- XmlSchemaValidator.cs
- MemberHolder.cs
- DataGridViewCellPaintingEventArgs.cs
- ComEventsMethod.cs
- LocatorPart.cs
- CalendarAutoFormat.cs
- ComponentManagerBroker.cs
- LabelDesigner.cs
- CursorConverter.cs
- ProfilePropertySettings.cs
- CodeIdentifier.cs
- WorkflowRuntimeServiceElement.cs
- ColorBlend.cs
- ComplusTypeValidator.cs
- ProtocolsConfigurationEntry.cs
- InfoCardService.cs
- CaseInsensitiveHashCodeProvider.cs
- FontFamilyValueSerializer.cs
- IndexedSelectQueryOperator.cs
- ErrorsHelper.cs
- Font.cs
- ImageAttributes.cs
- XmlAttribute.cs
- HttpResponseHeader.cs
- Bidi.cs
- EndPoint.cs
- TransactionContextValidator.cs
- HttpRequestCacheValidator.cs
- FunctionUpdateCommand.cs
- ImageMap.cs
- SiteMapNodeItemEventArgs.cs
- ContextStaticAttribute.cs
- FSWPathEditor.cs
- PaperSize.cs
- Tuple.cs
- OletxDependentTransaction.cs
- KnowledgeBase.cs
- GridViewDeletedEventArgs.cs