Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / ndp / fx / src / CompMod / System / ComponentModel / Design / InheritanceAttribute.cs / 1 / 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
- TypeGeneratedEventArgs.cs
- HttpProfileBase.cs
- ProviderUtil.cs
- NamedElement.cs
- TransactionsSectionGroup.cs
- SchemaInfo.cs
- UIPropertyMetadata.cs
- RequestReplyCorrelator.cs
- PropertyDescriptorGridEntry.cs
- SRGSCompiler.cs
- ElementAction.cs
- NullReferenceException.cs
- AddInServer.cs
- Rfc4050KeyFormatter.cs
- HwndHostAutomationPeer.cs
- WebPartVerb.cs
- HMACSHA256.cs
- WeakEventTable.cs
- ImageListStreamer.cs
- XmlSchemaSequence.cs
- ServerValidateEventArgs.cs
- ListCommandEventArgs.cs
- PauseStoryboard.cs
- MergeLocalizationDirectives.cs
- TokenBasedSet.cs
- DefaultProxySection.cs
- OperationAbortedException.cs
- DataGridRowAutomationPeer.cs
- StringFreezingAttribute.cs
- IChannel.cs
- SystemNetworkInterface.cs
- UrlParameterReader.cs
- MenuCommand.cs
- PropertyChangedEventArgs.cs
- SecureConversationDriver.cs
- BufferedReadStream.cs
- ControlCachePolicy.cs
- HttpWriter.cs
- TaiwanCalendar.cs
- ServiceSettingsResponseInfo.cs
- TraceContext.cs
- Ipv6Element.cs
- ping.cs
- BufferedWebEventProvider.cs
- LogicalExpressionEditor.cs
- CapabilitiesAssignment.cs
- StyleBamlRecordReader.cs
- XslTransform.cs
- WindowsTreeView.cs
- DataRowComparer.cs
- InstanceStoreQueryResult.cs
- XmlElementCollection.cs
- List.cs
- Choices.cs
- MethodAccessException.cs
- OledbConnectionStringbuilder.cs
- DisplayMemberTemplateSelector.cs
- SystemDropShadowChrome.cs
- UserPreferenceChangedEventArgs.cs
- glyphs.cs
- SeverityFilter.cs
- SizeAnimationBase.cs
- PublishLicense.cs
- DataSourceControl.cs
- UniqueEventHelper.cs
- ServiceBehaviorElement.cs
- SplashScreen.cs
- HttpGetProtocolImporter.cs
- FormatException.cs
- DataConnectionHelper.cs
- PropertySet.cs
- ClientSettingsSection.cs
- WmlMobileTextWriter.cs
- ALinqExpressionVisitor.cs
- HttpCacheVaryByContentEncodings.cs
- PackageDigitalSignatureManager.cs
- TrackingServices.cs
- TaiwanCalendar.cs
- SoapMessage.cs
- ViewCellRelation.cs
- CellParaClient.cs
- XPathDocumentIterator.cs
- ToolStripDropDownItem.cs
- ResolveCriteriaCD1.cs
- Int64AnimationBase.cs
- PropertyIDSet.cs
- MarkupWriter.cs
- DynamicValidatorEventArgs.cs
- SafeNativeMethods.cs
- Size.cs
- Stylus.cs
- SqlCacheDependencySection.cs
- grammarelement.cs
- XsdDateTime.cs
- OrderedDictionary.cs
- DataKeyArray.cs
- ToolStripDropDownMenu.cs
- EdmToObjectNamespaceMap.cs
- Set.cs
- TlsnegoTokenAuthenticator.cs