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
- SimpleHandlerBuildProvider.cs
- XmlEncodedRawTextWriter.cs
- FamilyTypeface.cs
- SmtpMail.cs
- Int16AnimationBase.cs
- DbSourceCommand.cs
- LinearKeyFrames.cs
- HtmlInputText.cs
- CollectionConverter.cs
- ColorAnimation.cs
- RoleManagerEventArgs.cs
- ControlPaint.cs
- SBCSCodePageEncoding.cs
- KeyPullup.cs
- SimpleApplicationHost.cs
- StaticFileHandler.cs
- EdmPropertyAttribute.cs
- MarkupExtensionReturnTypeAttribute.cs
- DataGridViewDataConnection.cs
- SecurityTokenSerializer.cs
- ToolStripDropDownClosingEventArgs.cs
- DesignerAttribute.cs
- MatrixTransform.cs
- SemanticResolver.cs
- SymLanguageVendor.cs
- DataBinder.cs
- ProtocolElementCollection.cs
- PageAsyncTaskManager.cs
- HTTP_SERVICE_CONFIG_URLACL_KEY.cs
- XPathScanner.cs
- OledbConnectionStringbuilder.cs
- MaskedTextBox.cs
- Propagator.JoinPropagator.cs
- HtmlMeta.cs
- TimeSpanOrInfiniteValidator.cs
- Odbc32.cs
- FontWeightConverter.cs
- TabItemAutomationPeer.cs
- TimerElapsedEvenArgs.cs
- TdsParserStaticMethods.cs
- ConfigXmlDocument.cs
- HostExecutionContextManager.cs
- ConfigurationValue.cs
- SrgsRule.cs
- XmlObjectSerializerReadContextComplexJson.cs
- RuleSettings.cs
- SqlDataSourceCommandParser.cs
- GridViewRowEventArgs.cs
- localization.cs
- InertiaTranslationBehavior.cs
- ServiceContractListItem.cs
- TagPrefixCollection.cs
- DeflateStream.cs
- RelationshipEnd.cs
- VisualStyleInformation.cs
- MenuAdapter.cs
- ellipse.cs
- DataRelation.cs
- SqlBulkCopyColumnMappingCollection.cs
- X509ScopedServiceCertificateElementCollection.cs
- PopOutPanel.cs
- HttpApplication.cs
- SqlClientWrapperSmiStream.cs
- CFStream.cs
- EntityTypeBase.cs
- AdornerHitTestResult.cs
- EntityContainerRelationshipSet.cs
- TextMetrics.cs
- TableChangeProcessor.cs
- ArgumentsParser.cs
- PkcsMisc.cs
- SerializerDescriptor.cs
- ParenthesizePropertyNameAttribute.cs
- FacetDescription.cs
- _CookieModule.cs
- CheckBox.cs
- DataBoundControlAdapter.cs
- SelectionRangeConverter.cs
- ConstructorExpr.cs
- SettingsBase.cs
- Selector.cs
- ThreadAbortException.cs
- TextEvent.cs
- SafeSystemMetrics.cs
- KeyEventArgs.cs
- ValueTable.cs
- UrlMappingsModule.cs
- XmlSchemaSimpleTypeList.cs
- AsyncPostBackErrorEventArgs.cs
- RequestQueryParser.cs
- wmiprovider.cs
- DataAdapter.cs
- TempEnvironment.cs
- XamlPoint3DCollectionSerializer.cs
- UnauthorizedWebPart.cs
- BitConverter.cs
- MatrixTransform3D.cs
- formatter.cs
- LoginCancelEventArgs.cs
- NominalTypeEliminator.cs