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
![Network programming in C#, Network Programming in VB.NET, Network Programming in .NET](/images/book.jpg)
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- GridItemPattern.cs
- TextEffect.cs
- CheckBoxPopupAdapter.cs
- SqlAggregateChecker.cs
- ContentElement.cs
- PackageFilter.cs
- SinglePageViewer.cs
- Crc32.cs
- PipelineDeploymentState.cs
- DbReferenceCollection.cs
- BasePropertyDescriptor.cs
- HtmlWindow.cs
- DataGridViewTextBoxCell.cs
- ValidatingCollection.cs
- IntPtr.cs
- WmlControlAdapter.cs
- ExpressionBuilderContext.cs
- GenericsInstances.cs
- BrowserInteropHelper.cs
- TextParagraphProperties.cs
- PipelineModuleStepContainer.cs
- BrowserCapabilitiesCompiler.cs
- sqlser.cs
- IncrementalReadDecoders.cs
- SecurityException.cs
- CookieProtection.cs
- SmiRecordBuffer.cs
- HotSpot.cs
- ListParaClient.cs
- BamlMapTable.cs
- EdmEntityTypeAttribute.cs
- DataGridCaption.cs
- DependencyPropertyValueSerializer.cs
- XmlEntityReference.cs
- ThemeDictionaryExtension.cs
- AppSettingsReader.cs
- AddInAttribute.cs
- FileVersion.cs
- MsmqException.cs
- SqlDataSourceQueryEditor.cs
- SimplePropertyEntry.cs
- StorageBasedPackageProperties.cs
- LogExtent.cs
- BuildResultCache.cs
- FloatSumAggregationOperator.cs
- LoginView.cs
- ListItemsCollectionEditor.cs
- BrowserCapabilitiesFactory.cs
- DataService.cs
- DataColumnMapping.cs
- StreamReader.cs
- XmlIlGenerator.cs
- HealthMonitoringSectionHelper.cs
- SystemResources.cs
- InternalPermissions.cs
- Lease.cs
- DebugInfoExpression.cs
- ReachPrintTicketSerializer.cs
- BitHelper.cs
- NominalTypeEliminator.cs
- BinaryEditor.cs
- StringSource.cs
- DetailsViewRowCollection.cs
- File.cs
- RegisteredHiddenField.cs
- CheckBoxRenderer.cs
- CallbackValidatorAttribute.cs
- TraceContextEventArgs.cs
- WebPart.cs
- PresentationTraceSources.cs
- followingsibling.cs
- CheckBox.cs
- ToolStripProfessionalLowResolutionRenderer.cs
- DictionaryCustomTypeDescriptor.cs
- BuildManagerHost.cs
- SqlGatherConsumedAliases.cs
- Comparer.cs
- CrossAppDomainChannel.cs
- CellParagraph.cs
- QilBinary.cs
- CheckBoxDesigner.cs
- NamedObject.cs
- StickyNoteAnnotations.cs
- CursorEditor.cs
- XmlCodeExporter.cs
- ProtocolException.cs
- Script.cs
- MessagePartSpecification.cs
- FunctionMappingTranslator.cs
- PointAnimation.cs
- StrongName.cs
- WebPartConnectionsDisconnectVerb.cs
- FormViewUpdatedEventArgs.cs
- NumberFormatInfo.cs
- SpellerError.cs
- QilBinary.cs
- RemoteAsymmetricSignatureFormatter.cs
- ObjectTag.cs
- DataSourceViewSchemaConverter.cs
- DesignTimeTemplateParser.cs