Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / CompMod / System / ComponentModel / Design / InheritanceAttribute.cs / 1305376 / InheritanceAttribute.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- /* */ namespace System.ComponentModel { using System.Security.Permissions; ////// [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event)] public sealed class InheritanceAttribute : Attribute { private readonly InheritanceLevel inheritanceLevel; ///Marks instances of objects that are inherited from their base class. This /// class cannot be inherited. ////// public static readonly InheritanceAttribute Inherited = new InheritanceAttribute(InheritanceLevel.Inherited); ////// Specifies that the component is inherited. This field is /// read-only. /// ////// public static readonly InheritanceAttribute InheritedReadOnly = new InheritanceAttribute(InheritanceLevel.InheritedReadOnly); ////// Specifies that /// the component is inherited and is read-only. This field is /// read-only. /// ////// public static readonly InheritanceAttribute NotInherited = new InheritanceAttribute(InheritanceLevel.NotInherited); ////// Specifies that the component is not inherited. This field is /// read-only. /// ////// public static readonly InheritanceAttribute Default = NotInherited; ////// Specifies the default value for /// the InheritanceAttribute as NotInherited. /// ////// public InheritanceAttribute() { inheritanceLevel = Default.inheritanceLevel; } ///Initializes a new instance of the System.ComponentModel.Design.InheritanceAttribute /// class. ////// public InheritanceAttribute(InheritanceLevel inheritanceLevel) { this.inheritanceLevel = inheritanceLevel; } ///Initializes a new instance of the System.ComponentModel.Design.InheritanceAttribute class /// with the specified inheritance /// level. ////// public InheritanceLevel InheritanceLevel { get { return inheritanceLevel; } } ////// Gets or sets /// the current inheritance level stored in this attribute. /// ////// public override bool Equals(object value) { if (value == this) { return true; } if (!(value is InheritanceAttribute)) { return false; } InheritanceLevel valueLevel = ((InheritanceAttribute)value).InheritanceLevel; return (valueLevel == inheritanceLevel); } ////// Override to test for equality. /// ////// public override int GetHashCode() { return base.GetHashCode(); } ////// Returns the hashcode for this object. /// ////// public override bool IsDefaultAttribute() { return (this.Equals(Default)); } ////// Gets whether this attribute is the default. /// ////// public override string ToString() { return TypeDescriptor.GetConverter(typeof(InheritanceLevel)).ConvertToString(InheritanceLevel); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ ///// Converts this attribute to a string. /// ///// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- /* */ namespace System.ComponentModel { using System.Security.Permissions; ////// [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event)] public sealed class InheritanceAttribute : Attribute { private readonly InheritanceLevel inheritanceLevel; ///Marks instances of objects that are inherited from their base class. This /// class cannot be inherited. ////// public static readonly InheritanceAttribute Inherited = new InheritanceAttribute(InheritanceLevel.Inherited); ////// Specifies that the component is inherited. This field is /// read-only. /// ////// public static readonly InheritanceAttribute InheritedReadOnly = new InheritanceAttribute(InheritanceLevel.InheritedReadOnly); ////// Specifies that /// the component is inherited and is read-only. This field is /// read-only. /// ////// public static readonly InheritanceAttribute NotInherited = new InheritanceAttribute(InheritanceLevel.NotInherited); ////// Specifies that the component is not inherited. This field is /// read-only. /// ////// public static readonly InheritanceAttribute Default = NotInherited; ////// Specifies the default value for /// the InheritanceAttribute as NotInherited. /// ////// public InheritanceAttribute() { inheritanceLevel = Default.inheritanceLevel; } ///Initializes a new instance of the System.ComponentModel.Design.InheritanceAttribute /// class. ////// public InheritanceAttribute(InheritanceLevel inheritanceLevel) { this.inheritanceLevel = inheritanceLevel; } ///Initializes a new instance of the System.ComponentModel.Design.InheritanceAttribute class /// with the specified inheritance /// level. ////// public InheritanceLevel InheritanceLevel { get { return inheritanceLevel; } } ////// Gets or sets /// the current inheritance level stored in this attribute. /// ////// public override bool Equals(object value) { if (value == this) { return true; } if (!(value is InheritanceAttribute)) { return false; } InheritanceLevel valueLevel = ((InheritanceAttribute)value).InheritanceLevel; return (valueLevel == inheritanceLevel); } ////// Override to test for equality. /// ////// public override int GetHashCode() { return base.GetHashCode(); } ////// Returns the hashcode for this object. /// ////// public override bool IsDefaultAttribute() { return (this.Equals(Default)); } ////// Gets whether this attribute is the default. /// ////// public override string ToString() { return TypeDescriptor.GetConverter(typeof(InheritanceLevel)).ConvertToString(InheritanceLevel); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007./// Converts this attribute to a string. /// ///
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- UpdateEventArgs.cs
- _ListenerResponseStream.cs
- PieceNameHelper.cs
- ChannelPoolSettings.cs
- BindingCollection.cs
- DeferredRunTextReference.cs
- IteratorDescriptor.cs
- SnapshotChangeTrackingStrategy.cs
- CodeDesigner.cs
- UpdateProgress.cs
- CodeCompiler.cs
- DefaultAsyncDataDispatcher.cs
- ColorMatrix.cs
- BlurEffect.cs
- SafeCryptContextHandle.cs
- CalendarDesigner.cs
- SourceFileBuildProvider.cs
- ReaderWriterLockWrapper.cs
- TCPClient.cs
- AnnotationHighlightLayer.cs
- PartManifestEntry.cs
- OutputScopeManager.cs
- HiddenFieldPageStatePersister.cs
- Visitor.cs
- XmlEventCache.cs
- SQLDecimal.cs
- MergePropertyDescriptor.cs
- SafeLocalMemHandle.cs
- ArithmeticException.cs
- DockPanel.cs
- X509Certificate2.cs
- ObjectItemCollection.cs
- Interop.cs
- WindowsGrip.cs
- JsonReader.cs
- AuthenticatingEventArgs.cs
- ControlPropertyNameConverter.cs
- VisualTreeFlattener.cs
- SharedStatics.cs
- TraceSection.cs
- DoubleAnimationClockResource.cs
- ServicePoint.cs
- XPathNodeInfoAtom.cs
- AtomPub10CategoriesDocumentFormatter.cs
- FormViewInsertEventArgs.cs
- PublishLicense.cs
- OrthographicCamera.cs
- RestClientProxyHandler.cs
- QueryTaskGroupState.cs
- TextTreeRootNode.cs
- EntityFunctions.cs
- SoapCodeExporter.cs
- HTMLTagNameToTypeMapper.cs
- XmlSchemaAny.cs
- ImageKeyConverter.cs
- PageRequestManager.cs
- FieldBuilder.cs
- Rotation3DAnimation.cs
- AttachedPropertyInfo.cs
- SqlClientWrapperSmiStream.cs
- CultureInfoConverter.cs
- ModelProperty.cs
- DataPagerField.cs
- SapiRecoInterop.cs
- BmpBitmapEncoder.cs
- NamedElement.cs
- NoneExcludedImageIndexConverter.cs
- RuleAction.cs
- ZipIOZip64EndOfCentralDirectoryBlock.cs
- PlatformNotSupportedException.cs
- SmiRequestExecutor.cs
- NamespaceList.cs
- SqlCacheDependencyDatabase.cs
- AmbientProperties.cs
- XmlBinaryWriter.cs
- Compensate.cs
- ProgressBarAutomationPeer.cs
- RoleManagerEventArgs.cs
- MatrixTransform.cs
- ErrorHandler.cs
- Executor.cs
- DataTable.cs
- SessionStateUtil.cs
- Package.cs
- SqlUserDefinedTypeAttribute.cs
- StrokeNode.cs
- DataPager.cs
- X509Utils.cs
- RealizationDrawingContextWalker.cs
- Application.cs
- InternalResources.cs
- DataBoundControlHelper.cs
- DataSpaceManager.cs
- SiteOfOriginPart.cs
- DefaultBinder.cs
- NumberFormatter.cs
- RsaKeyIdentifierClause.cs
- CapabilitiesRule.cs
- ScriptModule.cs
- EventBookmark.cs