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
- NotifyParentPropertyAttribute.cs
- DataGridViewMethods.cs
- DataTemplate.cs
- SessionParameter.cs
- VisemeEventArgs.cs
- XmlToDatasetMap.cs
- ModelItem.cs
- DocobjHost.cs
- StorageTypeMapping.cs
- Deflater.cs
- XmlSchemaImport.cs
- SupportsEventValidationAttribute.cs
- PathGeometry.cs
- ToolStripItemClickedEventArgs.cs
- MenuItemAutomationPeer.cs
- ThemeDictionaryExtension.cs
- ModuleConfigurationInfo.cs
- CornerRadiusConverter.cs
- RegistrationServices.cs
- EntityContainerEmitter.cs
- DeclaredTypeValidator.cs
- CodeAssignStatement.cs
- AssociatedControlConverter.cs
- AnnotationDocumentPaginator.cs
- FixedTextBuilder.cs
- XmlSchemaSimpleContent.cs
- SelectionRange.cs
- X509CertificateCollection.cs
- ProtocolsConfigurationHandler.cs
- SQLInt16Storage.cs
- ToolStripGrip.cs
- TypeBrowser.xaml.cs
- HttpHeaderCollection.cs
- TypeSemantics.cs
- PageSetupDialog.cs
- SqlInternalConnectionTds.cs
- UIElementIsland.cs
- SqlFactory.cs
- ValueType.cs
- DataRecordInternal.cs
- UriSectionReader.cs
- TableStyle.cs
- ClientProxyGenerator.cs
- SessionIDManager.cs
- AsnEncodedData.cs
- RsaSecurityKey.cs
- HttpConfigurationContext.cs
- MD5CryptoServiceProvider.cs
- StreamGeometry.cs
- RangeContentEnumerator.cs
- ControlPropertyNameConverter.cs
- AssociationSetEnd.cs
- XDRSchema.cs
- BaseCAMarshaler.cs
- PassportAuthenticationEventArgs.cs
- LogSwitch.cs
- ArraySortHelper.cs
- InfoCardAsymmetricCrypto.cs
- TargetConverter.cs
- X509Certificate.cs
- UIElement.cs
- CodeRemoveEventStatement.cs
- ExecutedRoutedEventArgs.cs
- MailAddressCollection.cs
- _ScatterGatherBuffers.cs
- EdmSchemaAttribute.cs
- Qualifier.cs
- DesignerDataTable.cs
- RichTextBoxConstants.cs
- ComplexTypeEmitter.cs
- SortedSet.cs
- BooleanExpr.cs
- X509CertificateCollection.cs
- RTLAwareMessageBox.cs
- DesignerTransaction.cs
- CodeSnippetCompileUnit.cs
- BoolLiteral.cs
- SrgsToken.cs
- MultipleCopiesCollection.cs
- MasterPage.cs
- MasterPageCodeDomTreeGenerator.cs
- SessionStateUtil.cs
- COM2IManagedPerPropertyBrowsingHandler.cs
- SqlDataRecord.cs
- ActionItem.cs
- TimeoutException.cs
- VoiceObjectToken.cs
- AttachmentService.cs
- TemplateBaseAction.cs
- MoveSizeWinEventHandler.cs
- sortedlist.cs
- AffineTransform3D.cs
- NativeCompoundFileAPIs.cs
- SettingsBindableAttribute.cs
- CheckedListBox.cs
- querybuilder.cs
- CapacityStreamGeometryContext.cs
- baseshape.cs
- TypeRefElement.cs
- NamedPipeTransportSecurityElement.cs