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
- ToolConsole.cs
- SiteMapNodeItemEventArgs.cs
- CharEnumerator.cs
- CompleteWizardStep.cs
- Debug.cs
- tibetanshape.cs
- DefaultCommandConverter.cs
- SystemParameters.cs
- ChannelDispatcher.cs
- FormsIdentity.cs
- RouteCollection.cs
- ObjectFactoryCodeDomTreeGenerator.cs
- ContainerAction.cs
- UnsafeNativeMethods.cs
- CommandHelpers.cs
- ServiceOperation.cs
- RtfToXamlLexer.cs
- ToolStripItemCollection.cs
- Int64AnimationBase.cs
- StoreItemCollection.Loader.cs
- MapPathBasedVirtualPathProvider.cs
- HtmlInputFile.cs
- XmlDataSourceView.cs
- _DynamicWinsockMethods.cs
- Vector3D.cs
- ProfileManager.cs
- ProviderConnectionPointCollection.cs
- CapabilitiesSection.cs
- WindowsSecurityTokenAuthenticator.cs
- ToolboxItemCollection.cs
- TemplateXamlParser.cs
- LayoutTableCell.cs
- ErrorTableItemStyle.cs
- EventItfInfo.cs
- _ChunkParse.cs
- CodeCommentStatementCollection.cs
- Hashtable.cs
- PrintController.cs
- OdbcTransaction.cs
- ByteAnimationBase.cs
- IODescriptionAttribute.cs
- StylusPointProperties.cs
- CngProvider.cs
- FileResponseElement.cs
- TextStore.cs
- OdbcConnectionPoolProviderInfo.cs
- DoubleAnimationClockResource.cs
- ThrowOnMultipleAssignment.cs
- ComAwareEventInfo.cs
- _NestedSingleAsyncResult.cs
- ImageMap.cs
- SingleAnimationUsingKeyFrames.cs
- Fonts.cs
- XmlSchemaAny.cs
- DesignRelationCollection.cs
- DesignerRegionCollection.cs
- DateTimeUtil.cs
- ColorDialog.cs
- selecteditemcollection.cs
- XPathDocumentBuilder.cs
- DataProtectionSecurityStateEncoder.cs
- TextTreeInsertElementUndoUnit.cs
- StreamUpdate.cs
- PageAsyncTask.cs
- ManagementDateTime.cs
- OdbcError.cs
- BindableTemplateBuilder.cs
- WeakReadOnlyCollection.cs
- SafeRegistryKey.cs
- ConfigXmlAttribute.cs
- SourceFileInfo.cs
- SupportsPreviewControlAttribute.cs
- DeploymentSectionCache.cs
- TraceLog.cs
- ReservationCollection.cs
- AmbientProperties.cs
- Rotation3DKeyFrameCollection.cs
- ThicknessAnimation.cs
- DataErrorValidationRule.cs
- ClientConfigurationSystem.cs
- XmlSchemaAll.cs
- ButtonFieldBase.cs
- GenericTextProperties.cs
- Stopwatch.cs
- PasswordPropertyTextAttribute.cs
- DisableDpiAwarenessAttribute.cs
- StructuredType.cs
- Stylesheet.cs
- PageThemeBuildProvider.cs
- TemplateContentLoader.cs
- CodeTypeMember.cs
- SQlBooleanStorage.cs
- StorageEndPropertyMapping.cs
- ColorContext.cs
- RouteValueExpressionBuilder.cs
- LassoHelper.cs
- ListViewTableRow.cs
- SystemWebCachingSectionGroup.cs
- ControlBuilderAttribute.cs
- ClientBuildManagerCallback.cs