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
- DetailsViewInsertedEventArgs.cs
- StylusCollection.cs
- SqlInternalConnectionSmi.cs
- FontDifferentiator.cs
- KeyNotFoundException.cs
- CompilerGeneratedAttribute.cs
- StringBlob.cs
- ToolStripContentPanelRenderEventArgs.cs
- ChannelServices.cs
- ExpandCollapseProviderWrapper.cs
- EventProperty.cs
- BoundPropertyEntry.cs
- JapaneseCalendar.cs
- CodeTypeDeclarationCollection.cs
- FileDialog_Vista.cs
- PropertyGridEditorPart.cs
- SoapAttributeOverrides.cs
- SerializableAttribute.cs
- UidManager.cs
- DataGridViewCellStyleEditor.cs
- DriveInfo.cs
- PackagePart.cs
- QilXmlWriter.cs
- FileRecordSequenceHelper.cs
- FieldToken.cs
- QuaternionRotation3D.cs
- DisplayMemberTemplateSelector.cs
- SchemaInfo.cs
- Image.cs
- WorkflowDesignerMessageFilter.cs
- InvalidDataException.cs
- cache.cs
- QilVisitor.cs
- ConstructorNeedsTagAttribute.cs
- StoragePropertyMapping.cs
- ListViewContainer.cs
- XPathArrayIterator.cs
- TypeConstant.cs
- DelegateTypeInfo.cs
- CompilationAssemblyInstallComponent.cs
- BitArray.cs
- CellRelation.cs
- OleDbReferenceCollection.cs
- RuntimeConfigurationRecord.cs
- AuthenticationModulesSection.cs
- XmlStringTable.cs
- Exceptions.cs
- TypeFieldSchema.cs
- UserNamePasswordValidator.cs
- Util.cs
- TypeDescriptionProviderAttribute.cs
- GradientStop.cs
- XmlNamedNodeMap.cs
- ProcessProtocolHandler.cs
- WSSecurityPolicy.cs
- SingleKeyFrameCollection.cs
- EUCJPEncoding.cs
- InkPresenterAutomationPeer.cs
- CreateUserWizardStep.cs
- CodeCompileUnit.cs
- OrthographicCamera.cs
- RC2CryptoServiceProvider.cs
- IntPtr.cs
- BaseCAMarshaler.cs
- LogExtentCollection.cs
- ServiceDescription.cs
- IndexingContentUnit.cs
- HMACMD5.cs
- AddInStore.cs
- SizeIndependentAnimationStorage.cs
- DisposableCollectionWrapper.cs
- SamlAction.cs
- SourceFileInfo.cs
- TextElement.cs
- TcpAppDomainProtocolHandler.cs
- TextRange.cs
- PropertyTabAttribute.cs
- ParentUndoUnit.cs
- WindowsScrollBarBits.cs
- MouseGestureValueSerializer.cs
- NativeMethods.cs
- SystemIcons.cs
- ToolStripLocationCancelEventArgs.cs
- ToolStripOverflowButton.cs
- WebBrowserDocumentCompletedEventHandler.cs
- AspNetSynchronizationContext.cs
- ExpressionBindingsDialog.cs
- CompositeDataBoundControl.cs
- DesignBindingConverter.cs
- CaseInsensitiveOrdinalStringComparer.cs
- PagedControl.cs
- Label.cs
- KeyValueInternalCollection.cs
- PointKeyFrameCollection.cs
- ItemAutomationPeer.cs
- BitmapScalingModeValidation.cs
- Substitution.cs
- StagingAreaInputItem.cs
- SchemaCollectionPreprocessor.cs
- DrawingVisualDrawingContext.cs