Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / 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
- shaper.cs
- ToolStripItemBehavior.cs
- SystemColorTracker.cs
- HierarchicalDataSourceControl.cs
- CellIdBoolean.cs
- MetadataException.cs
- RegexTypeEditor.cs
- EDesignUtil.cs
- ErrorFormatterPage.cs
- XmlILModule.cs
- DataGridHeaderBorder.cs
- DefaultDialogButtons.cs
- ToolStripItemTextRenderEventArgs.cs
- XmlArrayItemAttribute.cs
- MenuBindingsEditorForm.cs
- DataFormats.cs
- DataBoundLiteralControl.cs
- TableLayoutSettingsTypeConverter.cs
- FlowSwitchLink.cs
- Point4DValueSerializer.cs
- FontFamilyIdentifier.cs
- SafeProcessHandle.cs
- RTLAwareMessageBox.cs
- TcpConnectionPool.cs
- QueryOperationResponseOfT.cs
- IsolatedStoragePermission.cs
- MethodExecutor.cs
- TrackBarRenderer.cs
- InfoCardAsymmetricCrypto.cs
- XmlRawWriter.cs
- GcSettings.cs
- _ConnectOverlappedAsyncResult.cs
- PriorityQueue.cs
- DataGridViewRowCancelEventArgs.cs
- TaiwanLunisolarCalendar.cs
- _DisconnectOverlappedAsyncResult.cs
- DesignerTransaction.cs
- TextDecorationCollectionConverter.cs
- SiblingIterators.cs
- TTSEngineProxy.cs
- ColorInterpolationModeValidation.cs
- SettingsPropertyValueCollection.cs
- LayoutManager.cs
- StandardToolWindows.cs
- Console.cs
- DesignerOptionService.cs
- ImageButton.cs
- ProfileServiceManager.cs
- FileRegion.cs
- HashCryptoHandle.cs
- FormClosingEvent.cs
- ViewCellRelation.cs
- PropertyChangedEventManager.cs
- TextSearch.cs
- ItemsControl.cs
- ActivitiesCollection.cs
- OneOfScalarConst.cs
- activationcontext.cs
- CustomActivityDesigner.cs
- MailAddress.cs
- Mapping.cs
- NamespaceQuery.cs
- DynamicMethod.cs
- ColumnClickEvent.cs
- Constants.cs
- HttpCachePolicyElement.cs
- MetadataFile.cs
- MdiWindowListItemConverter.cs
- TraceXPathNavigator.cs
- TextServicesHost.cs
- DefaultTraceListener.cs
- PrimaryKeyTypeConverter.cs
- MimeAnyImporter.cs
- ZipFileInfoCollection.cs
- ColumnWidthChangedEvent.cs
- StructureChangedEventArgs.cs
- Scanner.cs
- XmlHierarchicalEnumerable.cs
- EnumCodeDomSerializer.cs
- ModuleElement.cs
- ManifestBasedResourceGroveler.cs
- WhitespaceRuleReader.cs
- DeflateStream.cs
- StateItem.cs
- SystemResourceKey.cs
- ClientFactory.cs
- ThreadAbortException.cs
- DefaultObjectMappingItemCollection.cs
- PictureBox.cs
- DefaultSection.cs
- RowsCopiedEventArgs.cs
- mediaeventshelper.cs
- LicenseManager.cs
- MsmqMessage.cs
- PageStatePersister.cs
- ValidatedControlConverter.cs
- RenderOptions.cs
- AttributeInfo.cs
- HitTestDrawingContextWalker.cs
- RemoteWebConfigurationHostStream.cs