Code:
/ 4.0 / 4.0 / untmp / 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.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- Base64Stream.cs
- ConfigurationValue.cs
- BeginStoryboard.cs
- DataGridViewRowDividerDoubleClickEventArgs.cs
- PlanCompilerUtil.cs
- RawStylusInputCustomDataList.cs
- CompositionCommandSet.cs
- Rect3DConverter.cs
- ShaperBuffers.cs
- GPStream.cs
- EndpointInfo.cs
- QilStrConcatenator.cs
- PeerEndPoint.cs
- HostedBindingBehavior.cs
- InProcStateClientManager.cs
- Encoding.cs
- WebControlToolBoxItem.cs
- ImageMap.cs
- _NegoStream.cs
- CaseExpr.cs
- DefaultBinder.cs
- TextTreeUndoUnit.cs
- IImplicitResourceProvider.cs
- BitmapEffectState.cs
- HttpCookie.cs
- QueryResponse.cs
- DecoderReplacementFallback.cs
- PermissionSetTriple.cs
- EntityStoreSchemaGenerator.cs
- SafeMemoryMappedFileHandle.cs
- SponsorHelper.cs
- Material.cs
- XamlBrushSerializer.cs
- Debug.cs
- _ChunkParse.cs
- Perspective.cs
- ServiceOperationDetailViewControl.cs
- PointConverter.cs
- SqlCachedBuffer.cs
- NativeMethods.cs
- EditableRegion.cs
- Triplet.cs
- StaticSiteMapProvider.cs
- Metadata.cs
- Mutex.cs
- ApplicationDirectory.cs
- ImpersonateTokenRef.cs
- Calendar.cs
- MemberHolder.cs
- CacheOutputQuery.cs
- DataGridViewCell.cs
- Ppl.cs
- _PooledStream.cs
- DomNameTable.cs
- ToolStripControlHost.cs
- VarInfo.cs
- HeaderUtility.cs
- DurableOperationAttribute.cs
- TreeViewHitTestInfo.cs
- PropertyGridEditorPart.cs
- NativeBuffer.cs
- EnumBuilder.cs
- NullableFloatMinMaxAggregationOperator.cs
- ConstraintConverter.cs
- SecurityContextKeyIdentifierClause.cs
- RepeatBehaviorConverter.cs
- DataGridCell.cs
- NominalTypeEliminator.cs
- BindingContext.cs
- RuntimeConfigLKG.cs
- Package.cs
- DefaultPropertyAttribute.cs
- DataGridViewHitTestInfo.cs
- MessageSmuggler.cs
- UpdateTranslator.cs
- PermissionListSet.cs
- DurableOperationContext.cs
- SchemaNamespaceManager.cs
- ContractMapping.cs
- OdbcParameter.cs
- ByteRangeDownloader.cs
- ApplicationId.cs
- TextElementEditingBehaviorAttribute.cs
- WpfPayload.cs
- XmlQueryType.cs
- ClientApiGenerator.cs
- BadImageFormatException.cs
- GCHandleCookieTable.cs
- _Win32.cs
- FrameworkPropertyMetadata.cs
- ScaleTransform3D.cs
- DemultiplexingClientMessageFormatter.cs
- DataGridClipboardHelper.cs
- CodeDomSerializerException.cs
- InputProcessorProfiles.cs
- StringToken.cs
- XmlSchemaAttributeGroupRef.cs
- ListBindingHelper.cs
- AstTree.cs
- AssociationProvider.cs