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
- Base64Encoder.cs
- LoginName.cs
- autovalidator.cs
- UrlMappingsSection.cs
- Transform.cs
- ValueSerializerAttribute.cs
- TreeViewItem.cs
- SizeF.cs
- DocumentXPathNavigator.cs
- TailCallAnalyzer.cs
- VisualBrush.cs
- SyndicationItemFormatter.cs
- SystemKeyConverter.cs
- DependencyPropertyValueSerializer.cs
- SyndicationDeserializer.cs
- PermissionSetTriple.cs
- Pair.cs
- UIElement3D.cs
- ConfigurationFileMap.cs
- PriorityRange.cs
- CDSsyncETWBCLProvider.cs
- HyperlinkAutomationPeer.cs
- EnumMember.cs
- SingleResultAttribute.cs
- PenLineCapValidation.cs
- AsymmetricCryptoHandle.cs
- Binding.cs
- ValidatedControlConverter.cs
- CatalogPartDesigner.cs
- HandledEventArgs.cs
- input.cs
- SystemIcmpV6Statistics.cs
- OdbcErrorCollection.cs
- GreaterThanOrEqual.cs
- CleanUpVirtualizedItemEventArgs.cs
- XmlNamedNodeMap.cs
- _IPv6Address.cs
- TransformerConfigurationWizardBase.cs
- List.cs
- MessageQueuePermission.cs
- EndpointReference.cs
- ToolStripPanelRenderEventArgs.cs
- autovalidator.cs
- AlternateViewCollection.cs
- XmlIlTypeHelper.cs
- LongValidatorAttribute.cs
- WindowsHyperlink.cs
- AnnotationComponentChooser.cs
- AdPostCacheSubstitution.cs
- OpenTypeMethods.cs
- CodeVariableReferenceExpression.cs
- KeyPullup.cs
- validation.cs
- PresentationTraceSources.cs
- TableCellsCollectionEditor.cs
- GiveFeedbackEvent.cs
- SplashScreen.cs
- EnumerableValidator.cs
- HttpCachePolicy.cs
- WindowsFormsHostAutomationPeer.cs
- InvokeProviderWrapper.cs
- IdentifierElement.cs
- XPathChildIterator.cs
- PropertyPathWorker.cs
- IPPacketInformation.cs
- Typography.cs
- ContainerParagraph.cs
- ButtonPopupAdapter.cs
- AuthenticateEventArgs.cs
- SQLCharsStorage.cs
- Int64KeyFrameCollection.cs
- TypeUtil.cs
- VarRemapper.cs
- PointValueSerializer.cs
- XmlValidatingReaderImpl.cs
- XPathException.cs
- WebPartUserCapability.cs
- SuppressMessageAttribute.cs
- DrawingServices.cs
- ProtocolViolationException.cs
- ContainerUIElement3D.cs
- FilterableAttribute.cs
- SubclassTypeValidatorAttribute.cs
- XmlReflectionImporter.cs
- Pair.cs
- CAGDesigner.cs
- FontStretches.cs
- XmlHierarchicalEnumerable.cs
- ToolStripMenuItemCodeDomSerializer.cs
- PrincipalPermission.cs
- ContentType.cs
- SignatureResourceHelper.cs
- EdmTypeAttribute.cs
- OperatingSystem.cs
- CodeCompiler.cs
- CmsInterop.cs
- TextBox.cs
- DtrList.cs
- MobilePage.cs
- ControlCodeDomSerializer.cs