/
DefaultBindingPropertyAttribute.cs
48 lines (41 loc) · 1.72 KB
/
DefaultBindingPropertyAttribute.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.Diagnostics.CodeAnalysis;
namespace System.ComponentModel
{
/// <summary>
/// Specifies the default binding property for a component.
/// </summary>
[AttributeUsage(AttributeTargets.Class)]
public sealed class DefaultBindingPropertyAttribute : Attribute
{
/// <summary>
/// Initializes a new instance of the <see cref='System.ComponentModel.DefaultBindingPropertyAttribute'/> class.
/// </summary>
public DefaultBindingPropertyAttribute()
{
}
/// <summary>
/// Initializes a new instance of the <see cref='System.ComponentModel.DefaultBindingPropertyAttribute'/> class.
/// </summary>
public DefaultBindingPropertyAttribute(string? name)
{
Name = name;
}
/// <summary>
/// Gets the name of the default binding property for the component this attribute is
/// bound to.
/// </summary>
public string? Name { get; }
/// <summary>
/// Specifies the default value for the <see cref='System.ComponentModel.DefaultBindingPropertyAttribute'/>, which is <see langword='null'/>. This
/// <see langword='static '/>field is read-only.
/// </summary>
public static readonly DefaultBindingPropertyAttribute Default = new DefaultBindingPropertyAttribute();
public override bool Equals([NotNullWhen(true)] object? obj)
{
return obj is DefaultBindingPropertyAttribute other && other.Name == Name;
}
public override int GetHashCode() => base.GetHashCode();
}
}