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
- NamespaceDecl.cs
- DesignerOptionService.cs
- ListBoxItem.cs
- ScrollData.cs
- PersistNameAttribute.cs
- RtfFormatStack.cs
- InternalConfirm.cs
- Emitter.cs
- SizeF.cs
- EntityDataSourceView.cs
- MonikerProxyAttribute.cs
- ConfigDefinitionUpdates.cs
- QilScopedVisitor.cs
- DirectionalLight.cs
- SessionParameter.cs
- ResourceAttributes.cs
- Page.cs
- CapabilitiesRule.cs
- GeneratedContractType.cs
- IgnoreSection.cs
- BindingParameterCollection.cs
- CompilerGlobalScopeAttribute.cs
- GetWinFXPath.cs
- DbConnectionStringBuilder.cs
- webeventbuffer.cs
- TransactionProtocolConverter.cs
- TextStore.cs
- Int32Rect.cs
- ClientSettingsProvider.cs
- MailWriter.cs
- ReadOnlyCollection.cs
- ToolStripItemGlyph.cs
- DesignerSerializerAttribute.cs
- WebSysDisplayNameAttribute.cs
- ConfigurationStrings.cs
- Base64Encoder.cs
- XmlCodeExporter.cs
- UrlPath.cs
- DataColumnCollection.cs
- TemplateEditingVerb.cs
- DesignerDataSourceView.cs
- IOThreadTimer.cs
- BufferBuilder.cs
- CapabilitiesUse.cs
- ChannelHandler.cs
- XpsFixedDocumentReaderWriter.cs
- Utility.cs
- CollectionViewGroup.cs
- DesignOnlyAttribute.cs
- XsdValidatingReader.cs
- FormView.cs
- UnconditionalPolicy.cs
- SocketPermission.cs
- DataRow.cs
- Semaphore.cs
- RSAPKCS1SignatureFormatter.cs
- RunClient.cs
- TraceEventCache.cs
- PageThemeParser.cs
- BuiltInExpr.cs
- LineSegment.cs
- XmlSchemaAppInfo.cs
- InitializationEventAttribute.cs
- ObjectItemCachedAssemblyLoader.cs
- SessionStateItemCollection.cs
- ActivityTrace.cs
- UpdateExpressionVisitor.cs
- CacheMode.cs
- DataGridViewCheckBoxCell.cs
- WindowsUpDown.cs
- Page.cs
- WebDisplayNameAttribute.cs
- ConfigXmlReader.cs
- HitTestFilterBehavior.cs
- BindingsCollection.cs
- PrintControllerWithStatusDialog.cs
- GridViewRowEventArgs.cs
- XmlSchemaImport.cs
- WebPartVerb.cs
- UIElementAutomationPeer.cs
- ContextMenuStripGroupCollection.cs
- TextShapeableCharacters.cs
- TextParentUndoUnit.cs
- DataTableTypeConverter.cs
- HighlightVisual.cs
- ContextActivityUtils.cs
- TextEditorMouse.cs
- WsdlHelpGeneratorElement.cs
- DrawingBrush.cs
- UidManager.cs
- PageThemeBuildProvider.cs
- HandlerBase.cs
- cookiecollection.cs
- XsltSettings.cs
- NumericUpDown.cs
- DrawingAttributes.cs
- ContentPlaceHolderDesigner.cs
- HostingPreferredMapPath.cs
- SignatureConfirmations.cs
- EventLogPermissionEntry.cs