/
DataObjectMethodAttribute.cs
47 lines (37 loc) · 1.39 KB
/
DataObjectMethodAttribute.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
// 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
{
[AttributeUsage(AttributeTargets.Method)]
public sealed class DataObjectMethodAttribute : Attribute
{
public DataObjectMethodAttribute(DataObjectMethodType methodType) : this(methodType, false)
{
}
public DataObjectMethodAttribute(DataObjectMethodType methodType, bool isDefault)
{
MethodType = methodType;
IsDefault = isDefault;
}
public bool IsDefault { get; }
public DataObjectMethodType MethodType { get; }
public override bool Equals([NotNullWhen(true)] object? obj)
{
if (obj == this)
{
return true;
}
return (obj is DataObjectMethodAttribute other) && (other.MethodType == MethodType) && (other.IsDefault == IsDefault);
}
public override int GetHashCode() => ((int)MethodType).GetHashCode() ^ IsDefault.GetHashCode();
public override bool Match([NotNullWhen(true)] object? obj)
{
if (obj == this)
{
return true;
}
return (obj is DataObjectMethodAttribute other) && (other.MethodType == MethodType);
}
}
}