//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//------------------------------------------------------------------------------
/*
*/
namespace System.ComponentModel {
using System;
using System.Diagnostics;
using System.Security.Permissions;
///
///
/// Specifies the visibility of this property or method as seen
/// by the designer serializer.
///
///
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Method | AttributeTargets.Field | AttributeTargets.Event)]
public sealed class DesignerSerializationVisibilityAttribute : Attribute {
///
///
/// Specifies that a visual designer should serialize the contents of this property,
/// rather than the property itself.
/// This field is read-only.
///
///
public static readonly DesignerSerializationVisibilityAttribute Content = new DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Content);
///
///
/// Specifies that a
/// visual designer will not serialize the value of this property.
/// This field is read-only.
///
///
public static readonly DesignerSerializationVisibilityAttribute Hidden = new DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Hidden);
///
///
/// Specifies that a
/// visual designer may use default rules when serializing the value of a property.
/// This field is read-only.
///
///
public static readonly DesignerSerializationVisibilityAttribute Visible = new DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Visible);
///
///
/// Specifies the default value, which is , that is, a visual designer
/// uses default rules to generate the value of a property. This
/// field is read-only.
///
///
public static readonly DesignerSerializationVisibilityAttribute Default = Visible;
private DesignerSerializationVisibility visibility;
///
///
/// Initializes a new instance of the System.ComponentModel.PersistContentsAttribute class.
///
///
public DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility visibility) {
this.visibility = visibility;
}
///
///
/// Gets a value indicating whether a
/// visual designer must generate special code to persist the value of a property.
///
///
public DesignerSerializationVisibility Visibility {
get {
return visibility;
}
}
///
///
///
public override bool Equals(object obj) {
if (obj == this) {
return true;
}
DesignerSerializationVisibilityAttribute other = obj as DesignerSerializationVisibilityAttribute;
return other != null && other.Visibility == visibility;
}
///
///
/// Returns the hashcode for this object.
///
///
public override int GetHashCode() {
return base.GetHashCode();
}
///
///
///
public override bool IsDefaultAttribute() {
return (this.Equals(Default));
}
}
}