Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Configuration / System / Configuration / KeyValueConfigurationElement.cs / 1305376 / 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
- MissingMemberException.cs
- ListViewInsertedEventArgs.cs
- Registry.cs
- FullTrustAssemblyCollection.cs
- SimpleExpression.cs
- AsymmetricSignatureFormatter.cs
- HttpListenerRequest.cs
- MetadataItemEmitter.cs
- DBPropSet.cs
- XmlSchemas.cs
- PrePrepareMethodAttribute.cs
- DataSetViewSchema.cs
- SplayTreeNode.cs
- ResizeGrip.cs
- XMLSyntaxException.cs
- ParentQuery.cs
- HtmlControl.cs
- QueryAsyncResult.cs
- FloaterBaseParagraph.cs
- KeyedCollection.cs
- ContentWrapperAttribute.cs
- XmlBinaryReader.cs
- StringPropertyBuilder.cs
- EventLogPermissionAttribute.cs
- ObjectSecurity.cs
- LayoutManager.cs
- DecoderBestFitFallback.cs
- TableItemStyle.cs
- InternalTypeHelper.cs
- IisTraceListener.cs
- LayoutEvent.cs
- SspiHelper.cs
- FlowDocumentPage.cs
- NaturalLanguageHyphenator.cs
- DynamicScriptObject.cs
- QuarticEase.cs
- SymbolMethod.cs
- SqlClientMetaDataCollectionNames.cs
- WindowsToolbar.cs
- TargetConverter.cs
- CodeMethodInvokeExpression.cs
- ObjectListCommandEventArgs.cs
- NativeMethods.cs
- PropertyPath.cs
- DataGridColumnHeaderAutomationPeer.cs
- PEFileReader.cs
- ObjectDataProvider.cs
- TemplateNameScope.cs
- TextServicesLoader.cs
- PassportAuthenticationModule.cs
- Message.cs
- AppSecurityManager.cs
- DoubleKeyFrameCollection.cs
- webproxy.cs
- UnmanagedBitmapWrapper.cs
- LocationFactory.cs
- XmlSchemas.cs
- BuilderElements.cs
- MailMessageEventArgs.cs
- Oid.cs
- SchemaNotation.cs
- TypeConverterMarkupExtension.cs
- RoleManagerModule.cs
- ContextMenuStripGroup.cs
- SqlUDTStorage.cs
- StringArrayConverter.cs
- _DynamicWinsockMethods.cs
- MDIWindowDialog.cs
- TrackingValidationObjectDictionary.cs
- AuthenticationModuleElement.cs
- _DisconnectOverlappedAsyncResult.cs
- SQlBooleanStorage.cs
- TimeSpanMinutesConverter.cs
- PropertyKey.cs
- DeploymentSection.cs
- ConnectionStringsExpressionEditor.cs
- XmlSchemaComplexContentExtension.cs
- ConstNode.cs
- UnknownWrapper.cs
- CapabilitiesRule.cs
- DataGridTablesFactory.cs
- Attributes.cs
- Int16Animation.cs
- PolyQuadraticBezierSegment.cs
- Propagator.ExtentPlaceholderCreator.cs
- XamlClipboardData.cs
- NativeCppClassAttribute.cs
- TextContainerChangedEventArgs.cs
- SqlLiftWhereClauses.cs
- DeadCharTextComposition.cs
- SliderAutomationPeer.cs
- BStrWrapper.cs
- XmlUnspecifiedAttribute.cs
- DataBindingHandlerAttribute.cs
- Attribute.cs
- _LocalDataStoreMgr.cs
- HandlerBase.cs
- SuppressedPackageProperties.cs
- CaseInsensitiveComparer.cs
- MemoryPressure.cs