Code:
/ 4.0 / 4.0 / untmp / 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.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- TickBar.cs
- Visual.cs
- LocationUpdates.cs
- TemplateBaseAction.cs
- TagPrefixInfo.cs
- DataList.cs
- WorkflowIdleElement.cs
- WebBrowserPermission.cs
- ComponentResourceManager.cs
- ExportOptions.cs
- XPathDocumentBuilder.cs
- InputScopeNameConverter.cs
- XmlValidatingReader.cs
- UnmanagedMarshal.cs
- ApplicationBuildProvider.cs
- ContextMenu.cs
- ErrorEventArgs.cs
- ModulesEntry.cs
- GetPolicyDetailsRequest.cs
- Group.cs
- ZipIOZip64EndOfCentralDirectoryLocatorBlock.cs
- MouseActionConverter.cs
- NavigatorOutput.cs
- CharacterBuffer.cs
- BufferedWebEventProvider.cs
- StreamGeometry.cs
- ConditionValidator.cs
- RegisteredExpandoAttribute.cs
- PngBitmapDecoder.cs
- StateWorkerRequest.cs
- ProjectionPlan.cs
- XmlElement.cs
- SystemWebSectionGroup.cs
- Socket.cs
- Visitor.cs
- RoleServiceManager.cs
- PrintControllerWithStatusDialog.cs
- DataGridViewBand.cs
- JpegBitmapEncoder.cs
- ClientData.cs
- TableRowsCollectionEditor.cs
- MetabaseServerConfig.cs
- DockingAttribute.cs
- ArrayMergeHelper.cs
- StatusBar.cs
- ChildrenQuery.cs
- ScriptResourceDefinition.cs
- RenderContext.cs
- DesignOnlyAttribute.cs
- ClickablePoint.cs
- LazyTextWriterCreator.cs
- ReadOnlyPropertyMetadata.cs
- TdsEnums.cs
- AppSecurityManager.cs
- Solver.cs
- ThreadStartException.cs
- NameValueFileSectionHandler.cs
- EventListener.cs
- Util.cs
- FixedNode.cs
- RootDesignerSerializerAttribute.cs
- NativeObjectSecurity.cs
- UpDownBase.cs
- ContentAlignmentEditor.cs
- SecurityException.cs
- DataGridViewRowHeightInfoNeededEventArgs.cs
- SafeThreadHandle.cs
- StatusStrip.cs
- TypeToken.cs
- ConfigXmlText.cs
- WebPartMinimizeVerb.cs
- ResizeGrip.cs
- StringUtil.cs
- WindowsButton.cs
- Configuration.cs
- DrawingGroup.cs
- XmlBinaryWriter.cs
- GenericTextProperties.cs
- PermissionSet.cs
- ObjectReferenceStack.cs
- ThreadAttributes.cs
- Blend.cs
- WebPartConnectionsConfigureVerb.cs
- XmlChildEnumerator.cs
- TargetControlTypeCache.cs
- DataGridLength.cs
- Animatable.cs
- ResponseStream.cs
- Behavior.cs
- RightsManagementEncryptedStream.cs
- _NegoState.cs
- _SpnDictionary.cs
- HeaderUtility.cs
- ExtendedPropertyDescriptor.cs
- ToggleButtonAutomationPeer.cs
- IsolatedStorageFilePermission.cs
- EnumUnknown.cs
- GeneralTransform3DTo2DTo3D.cs
- IfAction.cs
- UpDownBase.cs