Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / CompMod / System / Diagnostics / TypedElement.cs / 1305376 / TypedElement.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- using System.Configuration; using System; using System.Reflection; using System.Globalization; namespace System.Diagnostics { internal class TypedElement : ConfigurationElement { protected static readonly ConfigurationProperty _propTypeName = new ConfigurationProperty("type", typeof(string), String.Empty, ConfigurationPropertyOptions.IsRequired | ConfigurationPropertyOptions.IsTypeStringTransformationRequired); protected static readonly ConfigurationProperty _propInitData = new ConfigurationProperty("initializeData", typeof(string), String.Empty, ConfigurationPropertyOptions.None); protected ConfigurationPropertyCollection _properties; protected object _runtimeObject = null; private Type _baseType; public TypedElement(Type baseType) : base() { _properties = new ConfigurationPropertyCollection(); _properties.Add(_propTypeName); _properties.Add(_propInitData); _baseType = baseType; } [ConfigurationProperty("initializeData", DefaultValue = "")] public string InitData { get { return (string) this[_propInitData]; } // This is useful when the OM becomes public. In the meantime, this can be utilized via reflection set { this[_propInitData] = value; } } protected override ConfigurationPropertyCollection Properties { get { return _properties; } } [ConfigurationProperty("type", IsRequired = true, DefaultValue = "")] public virtual string TypeName { get { return (string) this[_propTypeName]; } set { this[_propTypeName] = value; } } protected object BaseGetRuntimeObject() { if (_runtimeObject == null) _runtimeObject = TraceUtils.GetRuntimeObject(TypeName, _baseType, InitData); return _runtimeObject; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- using System.Configuration; using System; using System.Reflection; using System.Globalization; namespace System.Diagnostics { internal class TypedElement : ConfigurationElement { protected static readonly ConfigurationProperty _propTypeName = new ConfigurationProperty("type", typeof(string), String.Empty, ConfigurationPropertyOptions.IsRequired | ConfigurationPropertyOptions.IsTypeStringTransformationRequired); protected static readonly ConfigurationProperty _propInitData = new ConfigurationProperty("initializeData", typeof(string), String.Empty, ConfigurationPropertyOptions.None); protected ConfigurationPropertyCollection _properties; protected object _runtimeObject = null; private Type _baseType; public TypedElement(Type baseType) : base() { _properties = new ConfigurationPropertyCollection(); _properties.Add(_propTypeName); _properties.Add(_propInitData); _baseType = baseType; } [ConfigurationProperty("initializeData", DefaultValue = "")] public string InitData { get { return (string) this[_propInitData]; } // This is useful when the OM becomes public. In the meantime, this can be utilized via reflection set { this[_propInitData] = value; } } protected override ConfigurationPropertyCollection Properties { get { return _properties; } } [ConfigurationProperty("type", IsRequired = true, DefaultValue = "")] public virtual string TypeName { get { return (string) this[_propTypeName]; } set { this[_propTypeName] = value; } } protected object BaseGetRuntimeObject() { if (_runtimeObject == null) _runtimeObject = TraceUtils.GetRuntimeObject(TypeName, _baseType, InitData); return _runtimeObject; } } } // 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
- SqlUserDefinedAggregateAttribute.cs
- SafeEventLogWriteHandle.cs
- GroupBoxRenderer.cs
- BitmapImage.cs
- RequestQueryProcessor.cs
- IpcClientManager.cs
- GeometryModel3D.cs
- Fonts.cs
- XamlFrame.cs
- DataGridViewRowsAddedEventArgs.cs
- DataGridBoolColumn.cs
- DataPagerCommandEventArgs.cs
- OracleCommandBuilder.cs
- Operand.cs
- AttachedPropertyBrowsableAttribute.cs
- ProcessModelInfo.cs
- ProjectionNode.cs
- Validator.cs
- ComplusTypeValidator.cs
- SortQuery.cs
- SQLInt64.cs
- ErrorTableItemStyle.cs
- DictionaryContent.cs
- Matrix3DValueSerializer.cs
- BackStopAuthenticationModule.cs
- StreamUpgradeAcceptor.cs
- AxDesigner.cs
- EndEvent.cs
- ProxyWebPartConnectionCollection.cs
- TranslateTransform.cs
- Baml2006SchemaContext.cs
- PersistChildrenAttribute.cs
- EntityChangedParams.cs
- AccessedThroughPropertyAttribute.cs
- MessageQueuePermission.cs
- NamespaceExpr.cs
- DbConnectionFactory.cs
- CollectionViewGroup.cs
- WindowsFormsSectionHandler.cs
- Model3D.cs
- Helpers.cs
- IssuedTokenClientElement.cs
- QilDataSource.cs
- XmlSchemaParticle.cs
- GB18030Encoding.cs
- DataReceivedEventArgs.cs
- AppDomainCompilerProxy.cs
- XmlQueryOutput.cs
- Error.cs
- RegexStringValidatorAttribute.cs
- ExistsInCollection.cs
- TextTreeRootNode.cs
- ellipse.cs
- DataServiceClientException.cs
- EntityReference.cs
- DataGridViewAutoSizeModeEventArgs.cs
- RealizationContext.cs
- StringUtil.cs
- AppSettingsReader.cs
- WebPartCatalogAddVerb.cs
- TransformerInfo.cs
- SecurityCriticalDataForSet.cs
- SpeechUI.cs
- WindowsScrollBarBits.cs
- CompilerErrorCollection.cs
- XmlTextReaderImplHelpers.cs
- AnnotationAuthorChangedEventArgs.cs
- HttpApplicationFactory.cs
- WebUtil.cs
- RightNameExpirationInfoPair.cs
- ApplicationSecurityInfo.cs
- FragmentNavigationEventArgs.cs
- App.cs
- DynamicPropertyReader.cs
- MultipartContentParser.cs
- x509utils.cs
- TabControlToolboxItem.cs
- DataGridViewSortCompareEventArgs.cs
- DesignerRegionMouseEventArgs.cs
- LocalBuilder.cs
- StringInfo.cs
- QueryComponents.cs
- LogRecordSequence.cs
- TextDecorationCollection.cs
- DataGridViewRow.cs
- Identifier.cs
- StringDictionary.cs
- WindowsRegion.cs
- DurationConverter.cs
- PropertyConverter.cs
- FindCriteriaElement.cs
- XmlSchemaSimpleType.cs
- DriveNotFoundException.cs
- NamespaceList.cs
- CircleHotSpot.cs
- Blend.cs
- DataSvcMapFile.cs
- TimelineGroup.cs
- ListChangedEventArgs.cs
- SaveWorkflowAsyncResult.cs