Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Configuration / System / Configuration / ConfigurationSection.cs / 1305376 / ConfigurationSection.cs
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
namespace System.Configuration {
using System;
using System.Collections.Specialized;
using System.Configuration.Internal;
using System.IO;
using System.Reflection;
using System.Security;
using System.Text;
using System.Xml;
using System.Globalization;
using System.Runtime.Versioning;
public abstract class ConfigurationSection : ConfigurationElement {
private SectionInformation _section;
// Constructor
//
protected ConfigurationSection() {
_section = new SectionInformation( this );
}
// SectionInformation property
//
// Retrieve the class associated with the Section information
//
public SectionInformation SectionInformation {
get {
return _section;
}
}
// GetRuntimeObject
//
// Return the Runtime Object for this Section
//
protected internal virtual object GetRuntimeObject() {
return this;
}
protected internal override bool IsModified() {
return ( SectionInformation.IsModifiedFlags() ||
base.IsModified() );
}
protected internal override void ResetModified() {
SectionInformation.ResetModifiedFlags();
base.ResetModified();
}
protected internal virtual void DeserializeSection(XmlReader reader) {
if (!reader.Read() || reader.NodeType != XmlNodeType.Element) {
throw new ConfigurationErrorsException(SR.GetString(SR.Config_base_expected_to_find_element), reader);
}
DeserializeElement(reader, false);
}
protected internal virtual string SerializeSection(ConfigurationElement parentElement, string name, ConfigurationSaveMode saveMode) {
if (CurrentConfiguration != null &&
CurrentConfiguration.TargetFramework != null &&
!ShouldSerializeSectionInTargetVersion(CurrentConfiguration.TargetFramework))
{
return string.Empty;
}
ValidateElement(this, null, true);
ConfigurationElement TempElement = CreateElement(this.GetType());
TempElement.Unmerge(this, parentElement, saveMode);
StringWriter strWriter = new StringWriter(CultureInfo.InvariantCulture);
XmlTextWriter writer = new XmlTextWriter(strWriter);
writer.Formatting = Formatting.Indented;
writer.Indentation = 4;
writer.IndentChar = ' ';
TempElement.DataToWriteInternal = (saveMode != ConfigurationSaveMode.Minimal);
if (CurrentConfiguration != null && CurrentConfiguration.TargetFramework != null)
_configRecord.SectionsStack.Push(this);
TempElement.SerializeToXmlElement(writer, name);
if (CurrentConfiguration != null && CurrentConfiguration.TargetFramework != null)
_configRecord.SectionsStack.Pop();
writer.Flush();
return strWriter.ToString();
}
protected internal virtual bool ShouldSerializePropertyInTargetVersion(ConfigurationProperty property, string propertyName, FrameworkName targetFramework, ConfigurationElement parentConfigurationElement) {
return true;
}
protected internal virtual bool ShouldSerializeElementInTargetVersion(ConfigurationElement element, string elementName, FrameworkName targetFramework) {
return true;
}
protected internal virtual bool ShouldSerializeSectionInTargetVersion(FrameworkName targetFramework) {
return true;
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- BrowserDefinition.cs
- ContextInformation.cs
- XPathNodeIterator.cs
- ArgIterator.cs
- CompiledAction.cs
- DateTimeConstantAttribute.cs
- IssuanceLicense.cs
- AutoResizedEvent.cs
- bidPrivateBase.cs
- PenLineCapValidation.cs
- TypeUnloadedException.cs
- DigitShape.cs
- MemberPath.cs
- WebControlsSection.cs
- propertyentry.cs
- MasterPage.cs
- WebEventTraceProvider.cs
- HtmlShimManager.cs
- BamlResourceDeserializer.cs
- DefaultEventAttribute.cs
- Helpers.cs
- HttpCacheVary.cs
- HitTestResult.cs
- ResourceContainer.cs
- XmlElementCollection.cs
- ProvidePropertyAttribute.cs
- DynamicRendererThreadManager.cs
- RepeaterItemEventArgs.cs
- OdbcEnvironmentHandle.cs
- XmlSchemaComplexContentExtension.cs
- LongValidator.cs
- FixedElement.cs
- EntityDataReader.cs
- LocalValueEnumerator.cs
- CoTaskMemUnicodeSafeHandle.cs
- TraceLevelStore.cs
- DocumentViewerAutomationPeer.cs
- ContextMarshalException.cs
- ZipIOExtraFieldZip64Element.cs
- XPathNodePointer.cs
- ClassHandlersStore.cs
- XmlRawWriter.cs
- URLAttribute.cs
- Debugger.cs
- SplineKeyFrames.cs
- ListViewInsertionMark.cs
- ScriptControlDescriptor.cs
- TreeBuilderXamlTranslator.cs
- PagedDataSource.cs
- SafeViewOfFileHandle.cs
- Rules.cs
- EventManager.cs
- RadioButtonStandardAdapter.cs
- DefaultTypeArgumentAttribute.cs
- SecurityDocument.cs
- DefaultDiscoveryService.cs
- Oid.cs
- LookupNode.cs
- BasicCommandTreeVisitor.cs
- BlurEffect.cs
- TableRowCollection.cs
- Clipboard.cs
- StringExpressionSet.cs
- LoginName.cs
- VerificationAttribute.cs
- FrameDimension.cs
- XmlSchemaIdentityConstraint.cs
- PanelStyle.cs
- SubpageParaClient.cs
- SortedList.cs
- ExpressionEditorAttribute.cs
- ImageSource.cs
- DoubleConverter.cs
- DiscoveryEndpointValidator.cs
- HtmlHistory.cs
- Bidi.cs
- AdornerLayer.cs
- FlowDocumentPageViewerAutomationPeer.cs
- ImportOptions.cs
- HostProtectionPermission.cs
- XmlEnumAttribute.cs
- WpfWebRequestHelper.cs
- SeekStoryboard.cs
- DataGridViewCellFormattingEventArgs.cs
- DataServicePagingProviderWrapper.cs
- ActivityDesigner.cs
- DBCommand.cs
- UmAlQuraCalendar.cs
- ServiceObjectContainer.cs
- References.cs
- securitycriticaldataformultiplegetandset.cs
- ScriptReference.cs
- ContractSearchPattern.cs
- Misc.cs
- _BaseOverlappedAsyncResult.cs
- GrammarBuilder.cs
- XsltFunctions.cs
- ListViewItemCollectionEditor.cs
- Blend.cs
- RegionIterator.cs