Code:
/ FX-1434 / FX-1434 / 1.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
- GraphicsPath.cs
- ColumnResizeUndoUnit.cs
- LoginStatusDesigner.cs
- ListView.cs
- Duration.cs
- FocusWithinProperty.cs
- BidOverLoads.cs
- TypeConverterHelper.cs
- Profiler.cs
- SessionEndingCancelEventArgs.cs
- TextRange.cs
- PrintPreviewDialog.cs
- ColorAnimationBase.cs
- TableParaClient.cs
- TextWriter.cs
- AutoGeneratedField.cs
- ParagraphResult.cs
- WsatConfiguration.cs
- XmlSchemaGroupRef.cs
- SqlBinder.cs
- LinearGradientBrush.cs
- StrongNameMembershipCondition.cs
- TextChange.cs
- ToolBarButtonClickEvent.cs
- loginstatus.cs
- GeneralTransformGroup.cs
- WindowsUpDown.cs
- PartialTrustVisibleAssembly.cs
- TreeBuilderBamlTranslator.cs
- CodeTypeMemberCollection.cs
- PriorityBindingExpression.cs
- WebPartTransformerCollection.cs
- StrokeCollectionConverter.cs
- SpeechUI.cs
- ForwardPositionQuery.cs
- FixedPageProcessor.cs
- DeviceContext.cs
- XmlIgnoreAttribute.cs
- WebPartUtil.cs
- OutputCacheSettingsSection.cs
- ResponseStream.cs
- ShapeTypeface.cs
- ProcessThread.cs
- OleDbPermission.cs
- Stack.cs
- SyntaxCheck.cs
- QueryConverter.cs
- UTF7Encoding.cs
- PropertyOverridesTypeEditor.cs
- InputBinding.cs
- FontFamily.cs
- BreadCrumbTextConverter.cs
- RequestCacheEntry.cs
- uribuilder.cs
- LocalizationParserHooks.cs
- RelationshipType.cs
- VBCodeProvider.cs
- PackageFilter.cs
- ChameleonKey.cs
- Label.cs
- ProvidersHelper.cs
- ArcSegment.cs
- FileDataSource.cs
- AnchoredBlock.cs
- MeasureItemEvent.cs
- EmissiveMaterial.cs
- InputProcessorProfiles.cs
- _ListenerResponseStream.cs
- SegmentInfo.cs
- KoreanLunisolarCalendar.cs
- XmlCustomFormatter.cs
- BuiltInExpr.cs
- Activation.cs
- HtmlInputButton.cs
- AuthenticateEventArgs.cs
- TimeSpanStorage.cs
- COM2EnumConverter.cs
- SingleStorage.cs
- SynchronizingStream.cs
- PhysicalOps.cs
- FormViewPageEventArgs.cs
- BinaryExpression.cs
- InstanceValue.cs
- AlphabeticalEnumConverter.cs
- EventMap.cs
- EmptyStringExpandableObjectConverter.cs
- AuthenticationManager.cs
- StateDesigner.TransitionInfo.cs
- CompositeActivityCodeGenerator.cs
- XmlSchemaAttributeGroupRef.cs
- TypedDataSetSchemaImporterExtension.cs
- InvalidProgramException.cs
- DropTarget.cs
- XmlnsCache.cs
- SqlPersonalizationProvider.cs
- SocketElement.cs
- ZipIOEndOfCentralDirectoryBlock.cs
- ClientSettingsSection.cs
- ProjectionPathBuilder.cs
- InfoCardBaseException.cs