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
- DataRecord.cs
- TextEditorLists.cs
- GradientStop.cs
- ExtensionFile.cs
- Size3DConverter.cs
- Mutex.cs
- UserMapPath.cs
- TextElementEnumerator.cs
- BinarySerializer.cs
- GridItemPattern.cs
- TraceShell.cs
- StatusBarAutomationPeer.cs
- CaseInsensitiveHashCodeProvider.cs
- Byte.cs
- HtmlPhoneCallAdapter.cs
- HashCodeCombiner.cs
- RegistrySecurity.cs
- GlobalizationAssembly.cs
- Attachment.cs
- SqlWebEventProvider.cs
- NativeMethods.cs
- DataShape.cs
- ErrorLog.cs
- DynamicRendererThreadManager.cs
- Registry.cs
- IgnoreDeviceFilterElement.cs
- MethodRental.cs
- ThreadStartException.cs
- TypeToken.cs
- DoubleAnimationUsingKeyFrames.cs
- RelativeSource.cs
- JsonReaderDelegator.cs
- TextRange.cs
- SimpleWorkerRequest.cs
- PropertyInfoSet.cs
- ConsoleTraceListener.cs
- InputScopeConverter.cs
- ConfigXmlSignificantWhitespace.cs
- TdsParserHelperClasses.cs
- DataGridItemEventArgs.cs
- VisualState.cs
- SmtpFailedRecipientsException.cs
- TraceHandler.cs
- ReadOnlyHierarchicalDataSource.cs
- ListenerElementsCollection.cs
- IPCCacheManager.cs
- ManagementPath.cs
- DummyDataSource.cs
- Collection.cs
- SafeCertificateStore.cs
- ShellProvider.cs
- PathFigure.cs
- DesignerVerbToolStripMenuItem.cs
- LogicalExpr.cs
- QilXmlWriter.cs
- SmtpNegotiateAuthenticationModule.cs
- FtpCachePolicyElement.cs
- TypeConstant.cs
- SamlAuthorizationDecisionStatement.cs
- EtwTrackingBehavior.cs
- ClickablePoint.cs
- MD5.cs
- DocumentXPathNavigator.cs
- IISUnsafeMethods.cs
- AvTraceDetails.cs
- RequestCacheEntry.cs
- _NetworkingPerfCounters.cs
- ContainerUtilities.cs
- Win32PrintDialog.cs
- GridViewDeletedEventArgs.cs
- BridgeDataRecord.cs
- DependsOnAttribute.cs
- EpmSourcePathSegment.cs
- RangeContentEnumerator.cs
- HtmlAnchor.cs
- StrokeCollection.cs
- connectionpool.cs
- GlyphTypeface.cs
- SizeChangedEventArgs.cs
- FrameworkObject.cs
- ChannelCredentials.cs
- ThaiBuddhistCalendar.cs
- List.cs
- InlinedLocationReference.cs
- SmtpNtlmAuthenticationModule.cs
- HtmlInputImage.cs
- WindowsFormsSynchronizationContext.cs
- EventLogInternal.cs
- Perspective.cs
- PageCopyCount.cs
- DrawingContextDrawingContextWalker.cs
- SqlCommand.cs
- SystemIcmpV6Statistics.cs
- TextEditorContextMenu.cs
- XNodeNavigator.cs
- ReturnType.cs
- LazyLoadBehavior.cs
- MailDefinitionBodyFileNameEditor.cs
- MLangCodePageEncoding.cs
- BatchParser.cs