Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / 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);
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
//------------------------------------------------------------------------------
//
// 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);
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- MarshalDirectiveException.cs
- CompModSwitches.cs
- ColumnResult.cs
- FilteredXmlReader.cs
- PointCollection.cs
- XmlDeclaration.cs
- UrlPath.cs
- WhileDesigner.cs
- PropertyRecord.cs
- ConnectionInterfaceCollection.cs
- DocumentEventArgs.cs
- ValueChangedEventManager.cs
- CharacterHit.cs
- DebuggerAttributes.cs
- Instrumentation.cs
- NameTable.cs
- SimpleMailWebEventProvider.cs
- CngAlgorithm.cs
- ThrowHelper.cs
- XamlToRtfWriter.cs
- ScrollChrome.cs
- TemplateBindingExpression.cs
- XmlDictionary.cs
- ErrorFormatter.cs
- AppSettings.cs
- SqlFormatter.cs
- AuthenticationService.cs
- StringPropertyBuilder.cs
- Debug.cs
- NumberSubstitution.cs
- Rect3DValueSerializer.cs
- DelegateOutArgument.cs
- XslTransformFileEditor.cs
- ExitEventArgs.cs
- ValidationError.cs
- ModifiableIteratorCollection.cs
- BitFlagsGenerator.cs
- KoreanLunisolarCalendar.cs
- ToolStripLabel.cs
- DependencyPropertyKey.cs
- ServiceOperationParameter.cs
- XmlSortKey.cs
- BindingExpressionBase.cs
- AnnotationService.cs
- RemoteArgument.cs
- OdbcParameter.cs
- TextEvent.cs
- FrameworkRichTextComposition.cs
- StaticExtension.cs
- DataGridViewRowsRemovedEventArgs.cs
- PageContent.cs
- NativeCppClassAttribute.cs
- SwitchAttribute.cs
- NumericExpr.cs
- FilePrompt.cs
- ReflectionPermission.cs
- safelinkcollection.cs
- PersonalizationStateInfo.cs
- PasswordRecovery.cs
- ListViewItem.cs
- HtmlInputHidden.cs
- NullableDoubleMinMaxAggregationOperator.cs
- ObjectItemAssemblyLoader.cs
- LocationInfo.cs
- CatalogPartCollection.cs
- ControllableStoryboardAction.cs
- DataGridViewColumnEventArgs.cs
- xamlnodes.cs
- FormViewUpdatedEventArgs.cs
- TableLayoutColumnStyleCollection.cs
- CreateRefExpr.cs
- NullRuntimeConfig.cs
- TextEffect.cs
- XmlSchemaExternal.cs
- PerformanceCounterNameAttribute.cs
- PermissionSetTriple.cs
- TemplateKey.cs
- ToolZone.cs
- CleanUpVirtualizedItemEventArgs.cs
- WsdlInspector.cs
- SqlCacheDependencySection.cs
- SplashScreen.cs
- IpcClientChannel.cs
- DependencyObjectProvider.cs
- MoveSizeWinEventHandler.cs
- WindowsIdentity.cs
- XmlAttribute.cs
- DataServiceHost.cs
- TextElementEnumerator.cs
- CategoryGridEntry.cs
- SaveFileDialog.cs
- HttpListenerException.cs
- JoinTreeNode.cs
- ForeignKeyConstraint.cs
- Int64Animation.cs
- WindowsEditBoxRange.cs
- SafeTokenHandle.cs
- HttpEncoder.cs
- DWriteFactory.cs
- unitconverter.cs