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
- ObjectDataSourceFilteringEventArgs.cs
- MDIClient.cs
- Command.cs
- Site.cs
- RequestCachePolicyConverter.cs
- TagElement.cs
- PrimitiveCodeDomSerializer.cs
- EntityDataSourceChangingEventArgs.cs
- CodeCompileUnit.cs
- Margins.cs
- SqlDataSourceCommandParser.cs
- GridSplitterAutomationPeer.cs
- Internal.cs
- SafeThreadHandle.cs
- isolationinterop.cs
- DataBindingList.cs
- followingsibling.cs
- AppDomainManager.cs
- Positioning.cs
- XmlCharCheckingWriter.cs
- ToolStripItemRenderEventArgs.cs
- InvokePatternIdentifiers.cs
- XmlNamespaceMapping.cs
- VariantWrapper.cs
- Ref.cs
- ApplicationBuildProvider.cs
- DocumentsTrace.cs
- TextUtf8RawTextWriter.cs
- EncryptedKey.cs
- RNGCryptoServiceProvider.cs
- OutputCacheSettings.cs
- Model3DGroup.cs
- AvTraceDetails.cs
- AddInIpcChannel.cs
- SynchronizingStream.cs
- ActivationServices.cs
- OpacityConverter.cs
- ListCommandEventArgs.cs
- XPathSelectionIterator.cs
- LocatorBase.cs
- DataBindingsDialog.cs
- DivideByZeroException.cs
- DeobfuscatingStream.cs
- MasterPage.cs
- EmptyEnumerable.cs
- ConfigurationSectionGroupCollection.cs
- Reference.cs
- BaseTemplateBuildProvider.cs
- CodeMemberProperty.cs
- CodeThrowExceptionStatement.cs
- TextTreeInsertElementUndoUnit.cs
- SQlBooleanStorage.cs
- ToolStripRenderEventArgs.cs
- NavigationHelper.cs
- ThousandthOfEmRealPoints.cs
- ServiceReference.cs
- ObjectTypeMapping.cs
- LeftCellWrapper.cs
- SiteMapHierarchicalDataSourceView.cs
- ShapingWorkspace.cs
- ResXBuildProvider.cs
- EventLogEntryCollection.cs
- StringBuilder.cs
- ManagementEventWatcher.cs
- PreProcessInputEventArgs.cs
- FormatException.cs
- MsmqIntegrationReceiveParameters.cs
- DataGridViewButtonColumn.cs
- NotifyParentPropertyAttribute.cs
- GifBitmapDecoder.cs
- ClipboardData.cs
- CompilerTypeWithParams.cs
- BaseComponentEditor.cs
- XmlSchemaType.cs
- MessageRpc.cs
- MetaType.cs
- DispatcherProcessingDisabled.cs
- SoapAttributeOverrides.cs
- XmlCharCheckingWriter.cs
- AnimationLayer.cs
- UserControl.cs
- DescendantBaseQuery.cs
- ExpressionTextBoxAutomationPeer.cs
- COM2Properties.cs
- InvalidCastException.cs
- ToolStripCollectionEditor.cs
- ChannelManagerHelpers.cs
- Dump.cs
- ApplicationGesture.cs
- XamlLoadErrorInfo.cs
- SoapProcessingBehavior.cs
- SpellerStatusTable.cs
- SystemUnicastIPAddressInformation.cs
- Atom10FormatterFactory.cs
- ActivityTrace.cs
- DrawingContext.cs
- RoleManagerSection.cs
- GridViewDeleteEventArgs.cs
- SendReply.cs
- MessageCredentialType.cs