Code:
/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / 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;
///
/// Marks instances of objects that are inherited from their base class. This
/// class cannot be inherited.
///
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event)]
public sealed class InheritanceAttribute : Attribute {
private readonly InheritanceLevel inheritanceLevel;
///
///
/// Specifies that the component is inherited. This field is
/// read-only.
///
///
public static readonly InheritanceAttribute Inherited = new InheritanceAttribute(InheritanceLevel.Inherited);
///
///
/// Specifies that
/// the component is inherited and is read-only. This field is
/// read-only.
///
///
public static readonly InheritanceAttribute InheritedReadOnly = new InheritanceAttribute(InheritanceLevel.InheritedReadOnly);
///
///
/// Specifies that the component is not inherited. This field is
/// read-only.
///
///
public static readonly InheritanceAttribute NotInherited = new InheritanceAttribute(InheritanceLevel.NotInherited);
///
///
/// Specifies the default value for
/// the InheritanceAttribute as NotInherited.
///
///
public static readonly InheritanceAttribute Default = NotInherited;
///
/// Initializes a new instance of the System.ComponentModel.Design.InheritanceAttribute
/// class.
///
public InheritanceAttribute() {
inheritanceLevel = Default.inheritanceLevel;
}
///
/// Initializes a new instance of the System.ComponentModel.Design.InheritanceAttribute class
/// with the specified inheritance
/// level.
///
public InheritanceAttribute(InheritanceLevel inheritanceLevel) {
this.inheritanceLevel = inheritanceLevel;
}
///
///
/// Gets or sets
/// the current inheritance level stored in this attribute.
///
///
public InheritanceLevel InheritanceLevel {
get {
return inheritanceLevel;
}
}
///
///
/// Override to test for equality.
///
///
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);
}
///
///
/// Returns the hashcode for this object.
///
///
public override int GetHashCode() {
return base.GetHashCode();
}
///
///
/// Gets whether this attribute is the default.
///
///
public override bool IsDefaultAttribute() {
return (this.Equals(Default));
}
///
///
/// Converts this attribute to a string.
///
///
public override string ToString() {
return TypeDescriptor.GetConverter(typeof(InheritanceLevel)).ConvertToString(InheritanceLevel);
}
}
}
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- CodeDirectiveCollection.cs
- SqlMethods.cs
- HtmlAnchor.cs
- ResourceType.cs
- MailAddressCollection.cs
- HotSpotCollection.cs
- FileSystemWatcher.cs
- BitmapInitialize.cs
- DrawingBrush.cs
- WeakKeyDictionary.cs
- GridViewItemAutomationPeer.cs
- HttpHandlersInstallComponent.cs
- AnnotationComponentManager.cs
- ToolStripSplitButton.cs
- DefaultValueTypeConverter.cs
- ContourSegment.cs
- Rotation3DKeyFrameCollection.cs
- PropertyValueChangedEvent.cs
- ApplicationServicesHostFactory.cs
- SpinWait.cs
- TransportContext.cs
- CompositeDataBoundControl.cs
- RoutedEventArgs.cs
- AppSettingsSection.cs
- RC2.cs
- SafeWaitHandle.cs
- HttpFileCollectionWrapper.cs
- ManualResetEvent.cs
- FieldMetadata.cs
- TableChangeProcessor.cs
- pingexception.cs
- ToolStripDropDownClosedEventArgs.cs
- DataGridViewTextBoxColumn.cs
- Regex.cs
- TransformedBitmap.cs
- MediaContextNotificationWindow.cs
- LogSwitch.cs
- PriorityBinding.cs
- LinqToSqlWrapper.cs
- WorkflowServiceHostFactory.cs
- MSAANativeProvider.cs
- WebHeaderCollection.cs
- FileDialog_Vista_Interop.cs
- ThreadStartException.cs
- ObjectAnimationBase.cs
- RemoteWebConfigurationHostServer.cs
- SafeRegistryKey.cs
- InvokeMemberBinder.cs
- AsymmetricSignatureFormatter.cs
- ObjectQueryProvider.cs
- Soap12ServerProtocol.cs
- ControlBuilder.cs
- RoutedEventConverter.cs
- listitem.cs
- ComponentConverter.cs
- QilStrConcatenator.cs
- TextTreeInsertUndoUnit.cs
- CryptoHelper.cs
- Region.cs
- LinearGradientBrush.cs
- RelatedPropertyManager.cs
- X509ServiceCertificateAuthentication.cs
- ServiceModelInstallComponent.cs
- CreateParams.cs
- UseAttributeSetsAction.cs
- XsltSettings.cs
- ToolStripItemImageRenderEventArgs.cs
- SqlProvider.cs
- DataGridViewTopLeftHeaderCell.cs
- XmlSchemaNotation.cs
- ScrollChrome.cs
- ProjectionRewriter.cs
- WebPartMovingEventArgs.cs
- FacetValues.cs
- ProgressBarBrushConverter.cs
- XMLUtil.cs
- XmlDataCollection.cs
- ExecutionEngineException.cs
- Parser.cs
- ProviderException.cs
- MetadataExchangeBindings.cs
- _LocalDataStoreMgr.cs
- Size.cs
- ImageIndexConverter.cs
- KeyValuePair.cs
- OleDbConnectionPoolGroupProviderInfo.cs
- documentsequencetextview.cs
- TreeViewCancelEvent.cs
- SqlDataReaderSmi.cs
- IdleTimeoutMonitor.cs
- AuthenticationSection.cs
- NavigationWindow.cs
- SecurityRuntime.cs
- Operand.cs
- XmlParser.cs
- Int32KeyFrameCollection.cs
- MSAANativeProvider.cs
- Asn1IntegerConverter.cs
- namescope.cs
- ProxyWebPartManager.cs