Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / 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
- CustomServiceCredentials.cs
- ProcessModuleCollection.cs
- ObjectContextServiceProvider.cs
- CommandDevice.cs
- RootCodeDomSerializer.cs
- UxThemeWrapper.cs
- HebrewNumber.cs
- BitmapEncoder.cs
- AttachedPropertyBrowsableForChildrenAttribute.cs
- FormsAuthenticationCredentials.cs
- TreeView.cs
- PolicyReader.cs
- PeerTransportSecurityElement.cs
- Color.cs
- unsafeIndexingFilterStream.cs
- BoolLiteral.cs
- XmlReflectionMember.cs
- DBCSCodePageEncoding.cs
- TreeWalker.cs
- SharedTcpTransportManager.cs
- FactoryRecord.cs
- ListViewItem.cs
- SafeHandles.cs
- JournalEntry.cs
- AnnotationStore.cs
- XmlAnyElementAttribute.cs
- WebFaultClientMessageInspector.cs
- BatchServiceHost.cs
- GridViewColumn.cs
- DataListCommandEventArgs.cs
- FormsAuthenticationCredentials.cs
- DeclarativeCatalogPart.cs
- PrintDialogDesigner.cs
- RangeEnumerable.cs
- FixedSOMPage.cs
- UserControlAutomationPeer.cs
- FrameworkRichTextComposition.cs
- Base64Stream.cs
- TickBar.cs
- GroupByExpressionRewriter.cs
- DispatcherFrame.cs
- AxImporter.cs
- DaylightTime.cs
- OleDbConnection.cs
- ProfileService.cs
- ColumnMap.cs
- EnvironmentPermission.cs
- Command.cs
- WebPartDeleteVerb.cs
- PeerApplication.cs
- TickBar.cs
- CodeTypeDeclaration.cs
- DbProviderServices.cs
- QueryMatcher.cs
- EnumMember.cs
- StringSorter.cs
- QueryStringParameter.cs
- SaveFileDialogDesigner.cs
- MarkupProperty.cs
- XmlWhitespace.cs
- StringUtil.cs
- FamilyMap.cs
- FtpRequestCacheValidator.cs
- SHA256Managed.cs
- HttpGetProtocolReflector.cs
- ParseHttpDate.cs
- ToolStripRenderEventArgs.cs
- RemotingServices.cs
- XPathNavigator.cs
- XmlDataSourceNodeDescriptor.cs
- oledbconnectionstring.cs
- TypedServiceChannelBuilder.cs
- WindowsListViewSubItem.cs
- EditorPartCollection.cs
- IBuiltInEvidence.cs
- DeobfuscatingStream.cs
- HostedAspNetEnvironment.cs
- TCPClient.cs
- XmlNodeList.cs
- ListItem.cs
- CorrelationKey.cs
- EdmSchemaAttribute.cs
- CalloutQueueItem.cs
- WebBrowserHelper.cs
- AutoSizeComboBox.cs
- exports.cs
- BitmapMetadata.cs
- Encoding.cs
- PathGradientBrush.cs
- CryptoApi.cs
- RuntimeArgument.cs
- XmlArrayItemAttribute.cs
- TextServicesDisplayAttribute.cs
- _OSSOCK.cs
- DoubleIndependentAnimationStorage.cs
- Module.cs
- Rectangle.cs
- StringUtil.cs
- WebPart.cs
- BinaryFormatter.cs