Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / 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
- TextParagraph.cs
- InvalidOleVariantTypeException.cs
- COM2PictureConverter.cs
- _NestedMultipleAsyncResult.cs
- MonthCalendar.cs
- Soap.cs
- QuadraticBezierSegment.cs
- CryptographicAttribute.cs
- CodeExporter.cs
- DataFormats.cs
- BoundColumn.cs
- CopyNodeSetAction.cs
- PauseStoryboard.cs
- XPathQilFactory.cs
- RootBrowserWindow.cs
- PreviewPrintController.cs
- WebHeaderCollection.cs
- ControlCachePolicy.cs
- DataViewManager.cs
- GridSplitterAutomationPeer.cs
- _ScatterGatherBuffers.cs
- SqlError.cs
- SrgsElementFactoryCompiler.cs
- WebPartUtil.cs
- DataGridViewSelectedCellsAccessibleObject.cs
- EventSource.cs
- CommonXSendMessage.cs
- ParserOptions.cs
- TdsParserStaticMethods.cs
- StylusEditingBehavior.cs
- XmlArrayItemAttribute.cs
- XmlNamedNodeMap.cs
- BounceEase.cs
- JumpTask.cs
- ServicePoint.cs
- OutputCacheProfile.cs
- PkcsUtils.cs
- Rotation3DAnimationBase.cs
- XpsFontSerializationService.cs
- XPathNavigatorReader.cs
- SystemDropShadowChrome.cs
- PolyQuadraticBezierSegment.cs
- WebPartAuthorizationEventArgs.cs
- TypeNameConverter.cs
- ReaderOutput.cs
- StringSource.cs
- CommandBinding.cs
- Aggregates.cs
- _emptywebproxy.cs
- ResourceCategoryAttribute.cs
- EnumType.cs
- Oid.cs
- UpdateCompiler.cs
- CorrelationService.cs
- HexParser.cs
- Control.cs
- ListViewDeletedEventArgs.cs
- StateDesigner.Helpers.cs
- Tuple.cs
- TemplatedMailWebEventProvider.cs
- TreeViewEvent.cs
- Internal.cs
- ActivityCodeDomReferenceService.cs
- TreeView.cs
- ApplicationDirectoryMembershipCondition.cs
- UnderstoodHeaders.cs
- SettingsPropertyValue.cs
- CombinedGeometry.cs
- ResXBuildProvider.cs
- ContractTypeNameCollection.cs
- DiscriminatorMap.cs
- CodeTypeMember.cs
- SoapRpcMethodAttribute.cs
- DesignerOptionService.cs
- ProfileInfo.cs
- ObjectDataSourceView.cs
- TreeView.cs
- ItemsPresenter.cs
- Point.cs
- SiteMapDataSource.cs
- StringAnimationBase.cs
- TextWriter.cs
- Opcode.cs
- PEFileReader.cs
- UrlAuthorizationModule.cs
- ProcessModelInfo.cs
- RelationshipEntry.cs
- DataGridViewRowHeaderCell.cs
- WebPartDescriptionCollection.cs
- StreamReader.cs
- TrustManagerPromptUI.cs
- WSFederationHttpSecurityElement.cs
- WindowsClientCredential.cs
- EventListenerClientSide.cs
- XPathBinder.cs
- AnnotationComponentManager.cs
- SerialPinChanges.cs
- SByteConverter.cs
- ConnectionPoolRegistry.cs
- ButtonStandardAdapter.cs