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
- AttributeUsageAttribute.cs
- ProcessMonitor.cs
- CmsInterop.cs
- ContainerVisual.cs
- relpropertyhelper.cs
- MaskInputRejectedEventArgs.cs
- CodeNamespaceImport.cs
- SoapBinding.cs
- InternalUserCancelledException.cs
- HandlerFactoryWrapper.cs
- FileClassifier.cs
- ZeroOpNode.cs
- TcpConnectionPoolSettingsElement.cs
- OdbcConnection.cs
- InternalsVisibleToAttribute.cs
- WSDualHttpSecurity.cs
- MsmqIntegrationValidationBehavior.cs
- IgnoreSection.cs
- PropertyItemInternal.cs
- DispatcherHooks.cs
- InfoCardKeyedHashAlgorithm.cs
- DataServiceQuery.cs
- ThreadStaticAttribute.cs
- PanelDesigner.cs
- DatePickerDateValidationErrorEventArgs.cs
- FileIOPermission.cs
- InfocardExtendedInformationEntry.cs
- ReadOnlyHierarchicalDataSourceView.cs
- RangeValuePattern.cs
- SemanticResultValue.cs
- HttpRequestContext.cs
- NameSpaceExtractor.cs
- RequestStatusBarUpdateEventArgs.cs
- SafeNativeMethods.cs
- FrameworkContentElement.cs
- RepeaterItem.cs
- MarkupExtensionParser.cs
- View.cs
- CreateUserWizard.cs
- X500Name.cs
- WindowInteropHelper.cs
- CompiledQuery.cs
- DataGridViewHitTestInfo.cs
- QilName.cs
- PrintPreviewControl.cs
- TextEditorSelection.cs
- AQNBuilder.cs
- IncrementalCompileAnalyzer.cs
- MultiSelector.cs
- DbReferenceCollection.cs
- PolygonHotSpot.cs
- Transform3DGroup.cs
- EntityDataSourceConfigureObjectContextPanel.cs
- Style.cs
- ProxyGenerator.cs
- AppSettingsReader.cs
- MemoryFailPoint.cs
- ScriptReference.cs
- MulticastOption.cs
- Util.cs
- MyContact.cs
- WorkItem.cs
- MonitorWrapper.cs
- Cursor.cs
- DrawItemEvent.cs
- SqlConnectionFactory.cs
- TemplateKeyConverter.cs
- UserNameSecurityTokenAuthenticator.cs
- SerializationException.cs
- EdmRelationshipRoleAttribute.cs
- Win32MouseDevice.cs
- FrameAutomationPeer.cs
- ECDsaCng.cs
- Int16Animation.cs
- TdsParserStaticMethods.cs
- PermissionRequestEvidence.cs
- FusionWrap.cs
- DataBoundControlActionList.cs
- Operand.cs
- TypedTableBase.cs
- UxThemeWrapper.cs
- DrawingImage.cs
- ScalarConstant.cs
- ApplicationException.cs
- Parameter.cs
- EntityDescriptor.cs
- ViewStateModeByIdAttribute.cs
- TableRowCollection.cs
- MemberJoinTreeNode.cs
- ConnectionManagementSection.cs
- PocoEntityKeyStrategy.cs
- Events.cs
- COM2Properties.cs
- DrawingGroupDrawingContext.cs
- VideoDrawing.cs
- WebPartCancelEventArgs.cs
- AmbientLight.cs
- ExpressionCopier.cs
- ResourcePart.cs
- PartitionedDataSource.cs