Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Configuration / System / Configuration / KeyValueConfigurationElement.cs / 1305376 / 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
- QueryReaderSettings.cs
- XmlExtensionFunction.cs
- ThousandthOfEmRealPoints.cs
- ReflectTypeDescriptionProvider.cs
- DbProviderServices.cs
- TextDecorations.cs
- PartialCachingAttribute.cs
- AnimationTimeline.cs
- InputBuffer.cs
- StickyNote.cs
- TextServicesCompartmentContext.cs
- XmlReflectionImporter.cs
- Privilege.cs
- ParseHttpDate.cs
- PolicyManager.cs
- ResourceExpressionBuilder.cs
- ClientSettingsStore.cs
- DataObjectPastingEventArgs.cs
- Padding.cs
- XPathDocument.cs
- ProtocolsConfiguration.cs
- SafeHandles.cs
- Selector.cs
- QilPatternVisitor.cs
- unsafeIndexingFilterStream.cs
- DetailsViewInsertedEventArgs.cs
- ReaderOutput.cs
- InternalControlCollection.cs
- DetailsViewDeletedEventArgs.cs
- BrowserTree.cs
- Sql8ConformanceChecker.cs
- XmlDocument.cs
- EntityDataSourceUtil.cs
- MaskInputRejectedEventArgs.cs
- XPathScanner.cs
- ProofTokenCryptoHandle.cs
- SqlTriggerAttribute.cs
- SerialPort.cs
- DataGridPagerStyle.cs
- HttpListenerRequest.cs
- BrowserDefinitionCollection.cs
- ViewCellSlot.cs
- GridViewSelectEventArgs.cs
- DataPagerFieldCommandEventArgs.cs
- HandlerMappingMemo.cs
- InputBindingCollection.cs
- NamespaceEmitter.cs
- GeneralTransformCollection.cs
- EventLogger.cs
- XmlQuerySequence.cs
- MatrixStack.cs
- objectquery_tresulttype.cs
- Evidence.cs
- PerfCounterSection.cs
- DisplayNameAttribute.cs
- WebContentFormatHelper.cs
- TabControlEvent.cs
- HttpCachePolicyElement.cs
- ScriptIgnoreAttribute.cs
- UiaCoreApi.cs
- IdentifierCollection.cs
- InkCanvasSelection.cs
- ObjectDataSourceSelectingEventArgs.cs
- CacheAxisQuery.cs
- WrappingXamlSchemaContext.cs
- RequestBringIntoViewEventArgs.cs
- AmbiguousMatchException.cs
- OleDbMetaDataFactory.cs
- PolicyException.cs
- HttpRequestTraceRecord.cs
- WindowsFormsLinkLabel.cs
- NeutralResourcesLanguageAttribute.cs
- Cursors.cs
- DataGrid.cs
- DataGridRowClipboardEventArgs.cs
- StylusPointDescription.cs
- RichTextBoxAutomationPeer.cs
- StronglyTypedResourceBuilder.cs
- FormViewDeleteEventArgs.cs
- SkinBuilder.cs
- SymbolType.cs
- MgmtConfigurationRecord.cs
- CharStorage.cs
- Event.cs
- DataTableNewRowEvent.cs
- EditorZoneAutoFormat.cs
- VisualTreeUtils.cs
- BrowserDefinition.cs
- BitmapEncoder.cs
- QilPatternFactory.cs
- XmlSerializationGeneratedCode.cs
- XmlEntityReference.cs
- Compensation.cs
- IRCollection.cs
- ValueProviderWrapper.cs
- ToolboxItem.cs
- HasCopySemanticsAttribute.cs
- ScriptingRoleServiceSection.cs
- ValidatingReaderNodeData.cs
- CmsInterop.cs