Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / ndp / fx / src / CompMod / System / Diagnostics / TypedElement.cs / 1 / 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); 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); 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
- FileSystemInfo.cs
- CodeTypeParameterCollection.cs
- XmlSchemaAttributeGroupRef.cs
- ExpandSegment.cs
- categoryentry.cs
- BaseHashHelper.cs
- TriggerBase.cs
- StringDictionary.cs
- DataControlImageButton.cs
- LaxModeSecurityHeaderElementInferenceEngine.cs
- CatalogPart.cs
- ChildTable.cs
- BinaryMethodMessage.cs
- TypeHelpers.cs
- BufferedGraphicsManager.cs
- WebBrowserUriTypeConverter.cs
- MyContact.cs
- SetState.cs
- Random.cs
- COM2ExtendedUITypeEditor.cs
- XmlNodeComparer.cs
- ErrorHandler.cs
- HtmlTableCellCollection.cs
- DataSourceControlBuilder.cs
- BindUriHelper.cs
- DataDocumentXPathNavigator.cs
- HashSetEqualityComparer.cs
- XmlSerializerNamespaces.cs
- ReadOnlyCollection.cs
- WorkflowDesignerColors.cs
- BinaryFormatter.cs
- XamlBrushSerializer.cs
- ViewgenContext.cs
- NavigateUrlConverter.cs
- ipaddressinformationcollection.cs
- PanelStyle.cs
- Triplet.cs
- NonParentingControl.cs
- CollectionsUtil.cs
- FlowDocumentView.cs
- ConfigXmlText.cs
- ListViewUpdatedEventArgs.cs
- HostedElements.cs
- XPathAncestorIterator.cs
- UniqueContractNameValidationBehavior.cs
- PersonalizationDictionary.cs
- CategoryEditor.cs
- UmAlQuraCalendar.cs
- Timeline.cs
- ProvidersHelper.cs
- FrameworkElementAutomationPeer.cs
- SByteStorage.cs
- SyndicationItemFormatter.cs
- ContourSegment.cs
- DirtyTextRange.cs
- DeclarativeCatalogPart.cs
- EventLogSession.cs
- TimeSpanStorage.cs
- MarginCollapsingState.cs
- ScrollBarRenderer.cs
- UpdateTranslator.cs
- SecurityRuntime.cs
- WindowsHyperlink.cs
- ModuleConfigurationInfo.cs
- PropertyChangeTracker.cs
- StringConverter.cs
- x509store.cs
- StringAnimationUsingKeyFrames.cs
- Base64Encoder.cs
- SqlPersonalizationProvider.cs
- DataGridItemAutomationPeer.cs
- Stylesheet.cs
- TransactionManager.cs
- MetadataReference.cs
- WebEventCodes.cs
- MailDefinition.cs
- PersonalizableAttribute.cs
- TextAnchor.cs
- _AcceptOverlappedAsyncResult.cs
- xmlfixedPageInfo.cs
- ICollection.cs
- Pen.cs
- FormatConvertedBitmap.cs
- CodeEntryPointMethod.cs
- ZoneIdentityPermission.cs
- Profiler.cs
- ValidationHelper.cs
- EditorPartCollection.cs
- DataGridItemEventArgs.cs
- FrameworkElement.cs
- DivideByZeroException.cs
- ByteStreamMessageUtility.cs
- ImageClickEventArgs.cs
- XLinq.cs
- ValidationService.cs
- CharAnimationUsingKeyFrames.cs
- WindowsBrush.cs
- SqlFacetAttribute.cs
- TextDecoration.cs
- CodeConditionStatement.cs