Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / ndp / fx / src / Configuration / System / Configuration / KeyValueConfigurationElement.cs / 1 / KeyValueConfigurationElement.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Configuration { using System; using System.Xml; using System.Configuration; using System.Collections.Specialized; using System.Collections; using System.IO; using System.Text; public class KeyValueConfigurationElement : ConfigurationElement { private static ConfigurationPropertyCollection _properties; private static readonly ConfigurationProperty _propKey = new ConfigurationProperty("key", typeof(string), String.Empty, ConfigurationPropertyOptions.IsKey | ConfigurationPropertyOptions.IsRequired); private static readonly ConfigurationProperty _propValue = new ConfigurationProperty("value", typeof(string), String.Empty, ConfigurationPropertyOptions.None); static KeyValueConfigurationElement() { // Property initialization _properties = new ConfigurationPropertyCollection(); _properties.Add(_propKey); _properties.Add(_propValue); } protected internal override ConfigurationPropertyCollection Properties { get { return _properties; } } bool _needsInit; string _initKey; string _initValue; // // Constructor // internal KeyValueConfigurationElement() { } public KeyValueConfigurationElement(string key, string value) { _needsInit = true; _initKey = key; _initValue = value; } protected internal override void Init() { base.Init(); // We cannot initialize configuration properties in the constructor, // because Properties is an overridable virtual property that // hence may not be available in the constructor. if (_needsInit) { _needsInit = false; base[_propKey] = _initKey; Value = _initValue; } } // // Properties // [ConfigurationProperty("key", Options = ConfigurationPropertyOptions.IsKey, DefaultValue = "")] public string Key { get { return (string)base[_propKey]; } } [ConfigurationProperty("value", DefaultValue = "")] public string Value { get { return (string)base[_propValue]; } set { base[_propValue] = value; } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Configuration { using System; using System.Xml; using System.Configuration; using System.Collections.Specialized; using System.Collections; using System.IO; using System.Text; public class KeyValueConfigurationElement : ConfigurationElement { private static ConfigurationPropertyCollection _properties; private static readonly ConfigurationProperty _propKey = new ConfigurationProperty("key", typeof(string), String.Empty, ConfigurationPropertyOptions.IsKey | ConfigurationPropertyOptions.IsRequired); private static readonly ConfigurationProperty _propValue = new ConfigurationProperty("value", typeof(string), String.Empty, ConfigurationPropertyOptions.None); static KeyValueConfigurationElement() { // Property initialization _properties = new ConfigurationPropertyCollection(); _properties.Add(_propKey); _properties.Add(_propValue); } protected internal override ConfigurationPropertyCollection Properties { get { return _properties; } } bool _needsInit; string _initKey; string _initValue; // // Constructor // internal KeyValueConfigurationElement() { } public KeyValueConfigurationElement(string key, string value) { _needsInit = true; _initKey = key; _initValue = value; } protected internal override void Init() { base.Init(); // We cannot initialize configuration properties in the constructor, // because Properties is an overridable virtual property that // hence may not be available in the constructor. if (_needsInit) { _needsInit = false; base[_propKey] = _initKey; Value = _initValue; } } // // Properties // [ConfigurationProperty("key", Options = ConfigurationPropertyOptions.IsKey, DefaultValue = "")] public string Key { get { return (string)base[_propKey]; } } [ConfigurationProperty("value", DefaultValue = "")] public string Value { get { return (string)base[_propValue]; } set { base[_propValue] = value; } } } } // 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
- SetterBase.cs
- WindowsProgressbar.cs
- SystemInfo.cs
- FreezableDefaultValueFactory.cs
- Item.cs
- EUCJPEncoding.cs
- RawStylusInputCustomData.cs
- DataGridItemCollection.cs
- MetadataPropertyCollection.cs
- RegexCharClass.cs
- ProcessManager.cs
- BindingManagerDataErrorEventArgs.cs
- ResourceCategoryAttribute.cs
- TreeViewAutomationPeer.cs
- OracleBinary.cs
- DbUpdateCommandTree.cs
- AspNetSynchronizationContext.cs
- DocumentSequence.cs
- Utilities.cs
- ExpressionHelper.cs
- XmlAttributeCollection.cs
- SchemaImporterExtensionElementCollection.cs
- CommonRemoteMemoryBlock.cs
- GridViewColumnHeader.cs
- CompilationAssemblyInstallComponent.cs
- DefaultPrintController.cs
- BordersPage.cs
- CompiledQueryCacheEntry.cs
- CreateUserWizardDesigner.cs
- BasePattern.cs
- DesignerActionHeaderItem.cs
- UnsafeNetInfoNativeMethods.cs
- DataServiceQuery.cs
- DynamicResourceExtension.cs
- DBConcurrencyException.cs
- Activation.cs
- FileController.cs
- FocusWithinProperty.cs
- InternalsVisibleToAttribute.cs
- SqlTriggerAttribute.cs
- BaseTemplatedMobileComponentEditor.cs
- DataPointer.cs
- BindingExpressionUncommonField.cs
- WebPartZoneBase.cs
- ButtonField.cs
- ExpressionNormalizer.cs
- Paragraph.cs
- BasicHttpBinding.cs
- DataSourceCacheDurationConverter.cs
- SurrogateSelector.cs
- Number.cs
- PropertyMetadata.cs
- PKCS1MaskGenerationMethod.cs
- VariableModifiersHelper.cs
- SerializationUtility.cs
- MissingManifestResourceException.cs
- ImageSourceConverter.cs
- UrlMappingCollection.cs
- ClientRuntimeConfig.cs
- XmlSchemaException.cs
- NumberSubstitution.cs
- DesignerActionMethodItem.cs
- SharedConnectionInfo.cs
- ImageListUtils.cs
- SequenceRangeCollection.cs
- JsonStringDataContract.cs
- MappableObjectManager.cs
- PropertyItem.cs
- NumericPagerField.cs
- RequestNavigateEventArgs.cs
- OracleInternalConnection.cs
- XmlArrayItemAttribute.cs
- MetafileHeaderWmf.cs
- LockingPersistenceProvider.cs
- CutCopyPasteHelper.cs
- sqlpipe.cs
- SchemaElementDecl.cs
- FileRecordSequenceCompletedAsyncResult.cs
- InputLanguage.cs
- TransferRequestHandler.cs
- StateChangeEvent.cs
- ResourcePermissionBase.cs
- SatelliteContractVersionAttribute.cs
- DataGridViewTextBoxColumn.cs
- NameGenerator.cs
- CodeAttributeArgumentCollection.cs
- WindowsPrincipal.cs
- BindingCompleteEventArgs.cs
- sqlser.cs
- FormatConvertedBitmap.cs
- FixedSOMPageConstructor.cs
- SqlTypeConverter.cs
- ContentIterators.cs
- FlowLayout.cs
- DateRangeEvent.cs
- ProcessHostMapPath.cs
- SolidColorBrush.cs
- ActivationServices.cs
- CodeDOMUtility.cs
- SerializationStore.cs